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

Unified Diff: source/convert_to_i420.cc

Issue 2020193002: Treat YU12 as an alias for I420. Simplify setting of inv_crop_height. (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | source/video_common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/convert_to_i420.cc
diff --git a/source/convert_to_i420.cc b/source/convert_to_i420.cc
index 5e75369b55ada99c35098f5c68743a066c3acf58..051e88ca0920e99698f30609196677caaa1b3eb0 100644
--- a/source/convert_to_i420.cc
+++ b/source/convert_to_i420.cc
@@ -40,11 +40,12 @@ int ConvertToI420(const uint8* sample,
const uint8* src;
const uint8* src_uv;
int abs_src_height = (src_height < 0) ? -src_height : src_height;
- int inv_crop_height = (crop_height < 0) ? -crop_height : crop_height;
+ // TODO(nisse): Why allow crop_height < 0?
+ int abs_crop_height = (crop_height < 0) ? -crop_height : crop_height;
magjed_chromium 2016/05/31 09:48:37 Can you make this const as well then?
nisse-chromium (ooo August 14) 2016/05/31 12:47:31 Done.
int r = 0;
LIBYUV_BOOL need_buf = (rotation && format != FOURCC_I420 &&
format != FOURCC_NV12 && format != FOURCC_NV21 &&
- format != FOURCC_YU12 && format != FOURCC_YV12) || y == sample;
+ format != FOURCC_YV12) || y == sample;
uint8* tmp_y = y;
uint8* tmp_u = u;
uint8* tmp_v = v;
@@ -52,16 +53,13 @@ int ConvertToI420(const uint8* sample,
int tmp_u_stride = u_stride;
int tmp_v_stride = v_stride;
uint8* rotate_buffer = NULL;
- int abs_crop_height = (crop_height < 0) ? -crop_height : crop_height;
+ int inv_crop_height = (src_height < 0) ? -abs_crop_height : abs_crop_height;
magjed_chromium 2016/05/31 09:48:37 ditto: Can you make this variable const?
nisse-chromium (ooo August 14) 2016/05/31 12:47:31 Done.
if (!y || !u || !v || !sample ||
src_width <= 0 || crop_width <= 0 ||
src_height == 0 || crop_height == 0) {
return -1;
}
- if (src_height < 0) {
- inv_crop_height = -inv_crop_height;
- }
// One pass rotation is available for some formats. For the rest, convert
// to I420 (with optional vertical flipping) into a temporary I420 buffer,
@@ -214,7 +212,6 @@ int ConvertToI420(const uint8* sample,
break;
// Triplanar formats
case FOURCC_I420:
- case FOURCC_YU12:
case FOURCC_YV12: {
const uint8* src_y = sample + (src_width * crop_y + crop_x);
const uint8* src_u;
« no previous file with comments | « no previous file | source/video_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698