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

Unified Diff: source/convert_to_argb.cc

Issue 2620183002: ConvertToARGB: Allows rotation on ARGB input (Closed)
Patch Set: Created 3 years, 11 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 | unit_test/convert_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/convert_to_argb.cc
diff --git a/source/convert_to_argb.cc b/source/convert_to_argb.cc
index 7f731197f5bd42f118d29d56a23c8f736b7e0fb2..f9e0e808a43b66ef8449f414762ae63420069b71 100644
--- a/source/convert_to_argb.cc
+++ b/source/convert_to_argb.cc
@@ -50,8 +50,8 @@ int ConvertToARGB(const uint8* sample,
int r = 0;
// One pass rotation is available for some formats. For the rest, convert
- // to I420 (with optional vertical flipping) into a temporary I420 buffer,
- // and then rotate the I420 to the final destination buffer.
+ // to ARGB (with optional vertical flipping) into a temporary ARGB buffer,
+ // and then rotate the ARGB to the final destination buffer.
// For in-place conversion, if destination crop_argb is same as source sample,
// also enable temporary buffer.
LIBYUV_BOOL need_buf =
@@ -102,9 +102,11 @@ int ConvertToARGB(const uint8* sample,
inv_crop_height);
break;
case FOURCC_ARGB:
- src = sample + (src_width * crop_y + crop_x) * 4;
- r = ARGBToARGB(src, src_width * 4, crop_argb, argb_stride, crop_width,
- inv_crop_height);
+ if (!need_buf && !rotation) {
fbarchard1 2017/01/11 19:42:16 FYI for I420 version the rotation is done here for
+ src = sample + (src_width * crop_y + crop_x) * 4;
+ r = ARGBToARGB(src, src_width * 4, crop_argb, argb_stride, crop_width,
+ inv_crop_height);
+ }
break;
case FOURCC_BGRA:
src = sample + (src_width * crop_y + crop_x) * 4;
@@ -253,6 +255,11 @@ int ConvertToARGB(const uint8* sample,
crop_width, abs_crop_height, rotation);
}
free(rotate_buffer);
+ } else if (rotation) {
+ src = sample + (src_width * crop_y + crop_x) * 4;
+ r = ARGBRotate(src, src_width * 4,
+ crop_argb, argb_stride,
+ crop_width, inv_crop_height, rotation);
}
return r;
« no previous file with comments | « no previous file | unit_test/convert_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698