Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: webrtc/media/base/videocommon.cc

Issue 1934503002: Delete unused video capture code for cropping, non-square pixels, and ARGB. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/base/videocommon.cc
diff --git a/webrtc/media/base/videocommon.cc b/webrtc/media/base/videocommon.cc
index f6f06c24e320ab3f51ade5ae08179a3af857d2c9..483cd3b8b9f979ac93fd8d5fb3e90a65eedd830d 100644
--- a/webrtc/media/base/videocommon.cc
+++ b/webrtc/media/base/videocommon.cc
@@ -134,70 +134,6 @@ void ComputeScale(int frame_width, int frame_height, int fps,
frame_width, frame_height, max_pixels, scaled_width, scaled_height);
}
-// Compute size to crop video frame to.
-// If cropped_format_* is 0, return the frame_* size as is.
-void ComputeCrop(int cropped_format_width, int cropped_format_height,
- int frame_width, int frame_height,
- int pixel_width, int pixel_height,
- int rotation,
- int* cropped_width, int* cropped_height) {
- // Transform screen crop to camera space if rotated.
- if (rotation == 90 || rotation == 270) {
- std::swap(cropped_format_width, cropped_format_height);
- }
- ASSERT(cropped_format_width >= 0);
- ASSERT(cropped_format_height >= 0);
- ASSERT(frame_width > 0);
- ASSERT(frame_height > 0);
- ASSERT(pixel_width >= 0);
- ASSERT(pixel_height >= 0);
- ASSERT(rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270);
- ASSERT(cropped_width != NULL);
- ASSERT(cropped_height != NULL);
- if (!pixel_width) {
- pixel_width = 1;
- }
- if (!pixel_height) {
- pixel_height = 1;
- }
- // if cropped_format is 0x0 disable cropping.
- if (!cropped_format_height) {
- cropped_format_height = 1;
- }
- float frame_aspect = static_cast<float>(frame_width * pixel_width) /
- static_cast<float>(frame_height * pixel_height);
- float crop_aspect = static_cast<float>(cropped_format_width) /
- static_cast<float>(cropped_format_height);
- // kAspectThresh is the maximum aspect ratio difference that we'll accept
- // for cropping. The value 1.34 allows cropping from 4:3 to 16:9.
- // Set to zero to disable cropping entirely.
- // TODO(fbarchard): crop to multiple of 16 width for better performance.
- const float kAspectThresh = 1.34f;
- // Wide aspect - crop horizontally
- if (frame_aspect > crop_aspect &&
- frame_aspect < crop_aspect * kAspectThresh) {
- // Round width down to multiple of 4 to avoid odd chroma width.
- // Width a multiple of 4 allows a half size image to have chroma channel
- // that avoids rounding errors.
- frame_width = static_cast<int>((crop_aspect * frame_height *
- pixel_height) / pixel_width + 0.5f) & ~3;
- } else if (frame_aspect < crop_aspect &&
- frame_aspect > crop_aspect / kAspectThresh) {
- frame_height = static_cast<int>((frame_width * pixel_width) /
- (crop_aspect * pixel_height) + 0.5f) & ~1;
- }
- *cropped_width = frame_width;
- *cropped_height = frame_height;
-}
-
-// Compute the frame size that makes pixels square pixel aspect ratio.
-void ComputeScaleToSquarePixels(int in_width, int in_height,
- int pixel_width, int pixel_height,
- int* scaled_width, int* scaled_height) {
- *scaled_width = in_width; // Keep width the same.
- *scaled_height = in_height * pixel_height / pixel_width;
-}
-
// The C++ standard requires a namespace-scope definition of static const
// integral types even when they are initialized in the declaration (see
// [class.static.data]/4), but MSVC with /Ze is non-conforming and treats that

Powered by Google App Engine
This is Rietveld 408576698