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

Side by Side Diff: source/convert_to_argb.cc

Issue 2406123002: Remove I411 support, update doc and switch to side by side test (Closed)
Patch Set: bump version, disable a few lint warnings Created 4 years, 2 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_jpeg.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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 src_width <= 0 || crop_width <= 0 || 60 src_width <= 0 || crop_width <= 0 ||
61 src_height == 0 || crop_height == 0) { 61 src_height == 0 || crop_height == 0) {
62 return -1; 62 return -1;
63 } 63 }
64 if (src_height < 0) { 64 if (src_height < 0) {
65 inv_crop_height = -inv_crop_height; 65 inv_crop_height = -inv_crop_height;
66 } 66 }
67 67
68 if (need_buf) { 68 if (need_buf) {
69 int argb_size = crop_width * 4 * abs_crop_height; 69 int argb_size = crop_width * 4 * abs_crop_height;
70 rotate_buffer = (uint8*)malloc(argb_size); 70 rotate_buffer = (uint8*)malloc(argb_size); /* NOLINT */
71 if (!rotate_buffer) { 71 if (!rotate_buffer) {
72 return 1; // Out of memory runtime error. 72 return 1; // Out of memory runtime error.
73 } 73 }
74 crop_argb = rotate_buffer; 74 crop_argb = rotate_buffer;
75 argb_stride = crop_width * 4; 75 argb_stride = crop_width * 4;
76 } 76 }
77 77
78 switch (format) { 78 switch (format) {
79 // Single plane formats 79 // Single plane formats
80 case FOURCC_YUY2: 80 case FOURCC_YUY2:
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 src_u = sample + src_width * (abs_src_height + crop_y) + crop_x; 255 src_u = sample + src_width * (abs_src_height + crop_y) + crop_x;
256 src_v = sample + src_width * (abs_src_height * 2 + crop_y) + crop_x; 256 src_v = sample + src_width * (abs_src_height * 2 + crop_y) + crop_x;
257 } 257 }
258 r = I444ToARGB(src_y, src_width, 258 r = I444ToARGB(src_y, src_width,
259 src_u, src_width, 259 src_u, src_width,
260 src_v, src_width, 260 src_v, src_width,
261 crop_argb, argb_stride, 261 crop_argb, argb_stride,
262 crop_width, inv_crop_height); 262 crop_width, inv_crop_height);
263 break; 263 break;
264 } 264 }
265 case FOURCC_I411: {
266 int quarterwidth = (src_width + 3) / 4;
267 const uint8* src_y = sample + src_width * crop_y + crop_x;
268 const uint8* src_u = sample + src_width * abs_src_height +
269 quarterwidth * crop_y + crop_x / 4;
270 const uint8* src_v = sample + src_width * abs_src_height +
271 quarterwidth * (abs_src_height + crop_y) + crop_x / 4;
272 r = I411ToARGB(src_y, src_width,
273 src_u, quarterwidth,
274 src_v, quarterwidth,
275 crop_argb, argb_stride,
276 crop_width, inv_crop_height);
277 break;
278 }
279 #ifdef HAVE_JPEG 265 #ifdef HAVE_JPEG
280 case FOURCC_MJPG: 266 case FOURCC_MJPG:
281 r = MJPGToARGB(sample, sample_size, 267 r = MJPGToARGB(sample, sample_size,
282 crop_argb, argb_stride, 268 crop_argb, argb_stride,
283 src_width, abs_src_height, crop_width, inv_crop_height); 269 src_width, abs_src_height, crop_width, inv_crop_height);
284 break; 270 break;
285 #endif 271 #endif
286 default: 272 default:
287 r = -1; // unknown fourcc - return failure code. 273 r = -1; // unknown fourcc - return failure code.
288 } 274 }
289 275
290 if (need_buf) { 276 if (need_buf) {
291 if (!r) { 277 if (!r) {
292 r = ARGBRotate(crop_argb, argb_stride, 278 r = ARGBRotate(crop_argb, argb_stride,
293 dest_argb, dest_argb_stride, 279 dest_argb, dest_argb_stride,
294 crop_width, abs_crop_height, rotation); 280 crop_width, abs_crop_height, rotation);
295 } 281 }
296 free(rotate_buffer); 282 free(rotate_buffer);
297 } 283 }
298 284
299 return r; 285 return r;
300 } 286 }
301 287
302 #ifdef __cplusplus 288 #ifdef __cplusplus
303 } // extern "C" 289 } // extern "C"
304 } // namespace libyuv 290 } // namespace libyuv
305 #endif 291 #endif
OLDNEW
« no previous file with comments | « source/convert_jpeg.cc ('k') | source/convert_to_i420.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698