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

Side by Side Diff: source/convert_to_i420.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_to_argb.cc ('k') | source/row_any.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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 // One pass rotation is available for some formats. For the rest, convert 65 // One pass rotation is available for some formats. For the rest, convert
66 // to I420 (with optional vertical flipping) into a temporary I420 buffer, 66 // to I420 (with optional vertical flipping) into a temporary I420 buffer,
67 // and then rotate the I420 to the final destination buffer. 67 // and then rotate the I420 to the final destination buffer.
68 // For in-place conversion, if destination y is same as source sample, 68 // For in-place conversion, if destination y is same as source sample,
69 // also enable temporary buffer. 69 // also enable temporary buffer.
70 if (need_buf) { 70 if (need_buf) {
71 int y_size = crop_width * abs_crop_height; 71 int y_size = crop_width * abs_crop_height;
72 int uv_size = ((crop_width + 1) / 2) * ((abs_crop_height + 1) / 2); 72 int uv_size = ((crop_width + 1) / 2) * ((abs_crop_height + 1) / 2);
73 rotate_buffer = (uint8*)malloc(y_size + uv_size * 2); 73 rotate_buffer = (uint8*)malloc(y_size + uv_size * 2); /* NOLINT */
74 if (!rotate_buffer) { 74 if (!rotate_buffer) {
75 return 1; // Out of memory runtime error. 75 return 1; // Out of memory runtime error.
76 } 76 }
77 y = rotate_buffer; 77 y = rotate_buffer;
78 u = y + y_size; 78 u = y + y_size;
79 v = u + uv_size; 79 v = u + uv_size;
80 y_stride = crop_width; 80 y_stride = crop_width;
81 u_stride = v_stride = ((crop_width + 1) / 2); 81 u_stride = v_stride = ((crop_width + 1) / 2);
82 } 82 }
83 83
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 279 }
280 r = I444ToI420(src_y, src_width, 280 r = I444ToI420(src_y, src_width,
281 src_u, src_width, 281 src_u, src_width,
282 src_v, src_width, 282 src_v, src_width,
283 y, y_stride, 283 y, y_stride,
284 u, u_stride, 284 u, u_stride,
285 v, v_stride, 285 v, v_stride,
286 crop_width, inv_crop_height); 286 crop_width, inv_crop_height);
287 break; 287 break;
288 } 288 }
289 case FOURCC_I411: {
290 int quarterwidth = (src_width + 3) / 4;
291 const uint8* src_y = sample + src_width * crop_y + crop_x;
292 const uint8* src_u = sample + src_width * abs_src_height +
293 quarterwidth * crop_y + crop_x / 4;
294 const uint8* src_v = sample + src_width * abs_src_height +
295 quarterwidth * (abs_src_height + crop_y) + crop_x / 4;
296 r = I411ToI420(src_y, src_width,
297 src_u, quarterwidth,
298 src_v, quarterwidth,
299 y, y_stride,
300 u, u_stride,
301 v, v_stride,
302 crop_width, inv_crop_height);
303 break;
304 }
305 #ifdef HAVE_JPEG 289 #ifdef HAVE_JPEG
306 case FOURCC_MJPG: 290 case FOURCC_MJPG:
307 r = MJPGToI420(sample, sample_size, 291 r = MJPGToI420(sample, sample_size,
308 y, y_stride, 292 y, y_stride,
309 u, u_stride, 293 u, u_stride,
310 v, v_stride, 294 v, v_stride,
311 src_width, abs_src_height, crop_width, inv_crop_height); 295 src_width, abs_src_height, crop_width, inv_crop_height);
312 break; 296 break;
313 #endif 297 #endif
314 default: 298 default:
(...skipping 13 matching lines...) Expand all
328 free(rotate_buffer); 312 free(rotate_buffer);
329 } 313 }
330 314
331 return r; 315 return r;
332 } 316 }
333 317
334 #ifdef __cplusplus 318 #ifdef __cplusplus
335 } // extern "C" 319 } // extern "C"
336 } // namespace libyuv 320 } // namespace libyuv
337 #endif 321 #endif
OLDNEW
« no previous file with comments | « source/convert_to_argb.cc ('k') | source/row_any.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698