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

Side by Side Diff: source/convert_to_argb.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: Update ConvertFromI420, ConvertToARGB and TestCanonicalFourCC for YU12 being an alias. Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « source/convert_from.cc ('k') | source/convert_to_i420.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 crop_width, inv_crop_height); 169 crop_width, inv_crop_height);
170 break; 170 break;
171 case FOURCC_M420: 171 case FOURCC_M420:
172 src = sample + (src_width * crop_y) * 12 / 8 + crop_x; 172 src = sample + (src_width * crop_y) * 12 / 8 + crop_x;
173 r = M420ToARGB(src, src_width, 173 r = M420ToARGB(src, src_width,
174 crop_argb, argb_stride, 174 crop_argb, argb_stride,
175 crop_width, inv_crop_height); 175 crop_width, inv_crop_height);
176 break; 176 break;
177 // Triplanar formats 177 // Triplanar formats
178 case FOURCC_I420: 178 case FOURCC_I420:
179 case FOURCC_YU12:
180 case FOURCC_YV12: { 179 case FOURCC_YV12: {
181 const uint8* src_y = sample + (src_width * crop_y + crop_x); 180 const uint8* src_y = sample + (src_width * crop_y + crop_x);
182 const uint8* src_u; 181 const uint8* src_u;
183 const uint8* src_v; 182 const uint8* src_v;
184 int halfwidth = (src_width + 1) / 2; 183 int halfwidth = (src_width + 1) / 2;
185 int halfheight = (abs_src_height + 1) / 2; 184 int halfheight = (abs_src_height + 1) / 2;
186 if (format == FOURCC_YV12) { 185 if (format == FOURCC_YV12) {
187 src_v = sample + src_width * abs_src_height + 186 src_v = sample + src_width * abs_src_height +
188 (halfwidth * crop_y + crop_x) / 2; 187 (halfwidth * crop_y + crop_x) / 2;
189 src_u = sample + src_width * abs_src_height + 188 src_u = sample + src_width * abs_src_height +
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 free(rotate_buffer); 296 free(rotate_buffer);
298 } 297 }
299 298
300 return r; 299 return r;
301 } 300 }
302 301
303 #ifdef __cplusplus 302 #ifdef __cplusplus
304 } // extern "C" 303 } // extern "C"
305 } // namespace libyuv 304 } // namespace libyuv
306 #endif 305 #endif
OLDNEW
« no previous file with comments | « source/convert_from.cc ('k') | source/convert_to_i420.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698