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

Side by Side Diff: media/base/yuv_convert.cc

Issue 9320025: Introducing a helper wrapper for YUV-to-RGB convertion and/or scaling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make VC++ happy, take two. Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/base/decoder_vp8.h » ('j') | remoting/base/util.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This webpage shows layout of YV12 and other YUV formats 5 // This webpage shows layout of YV12 and other YUV formats
6 // http://www.fourcc.org/yuv.php 6 // http://www.fourcc.org/yuv.php
7 // The actual conversion is best described here 7 // The actual conversion is best described here
8 // http://en.wikipedia.org/wiki/YUV 8 // http://en.wikipedia.org/wiki/YUV
9 // An article on optimizing YUV conversion using tables instead of multiplies 9 // An article on optimizing YUV conversion using tables instead of multiplies
10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf 10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 328 }
329 int source_top = dest_rect_top * y_step; 329 int source_top = dest_rect_top * y_step;
330 if (y_step < kFractionMax * 2) { 330 if (y_step < kFractionMax * 2) {
331 source_top += ((y_step - kFractionMax) / 2); 331 source_top += ((y_step - kFractionMax) / 2);
332 } else { 332 } else {
333 source_top += kFractionMax / 2; 333 source_top += kFractionMax / 2;
334 } 334 }
335 335
336 // Determine the parts of the Y, U and V buffers to interpolate. 336 // Determine the parts of the Y, U and V buffers to interpolate.
337 int source_y_left = source_left >> kFractionBits; 337 int source_y_left = source_left >> kFractionBits;
338 int source_y_right = (source_right >> kFractionBits) + 2; 338 int source_y_right = std::min(
339 DCHECK(source_y_right <= source_width); 339 (source_right >> kFractionBits) + 2,
340 source_width + 1);
Wez 2012/02/03 22:40:35 Not sure why this needed to change?
alexeypa (please no reviews) 2012/02/03 23:29:35 Because I hit this DCHECK on a legitimate call (Yu
340 341
341 int source_uv_left = source_y_left / 2; 342 int source_uv_left = source_y_left / 2;
342 int source_uv_right = std::min( 343 int source_uv_right = std::min(
343 (source_right >> (kFractionBits + 1)) + 2, 344 (source_right >> (kFractionBits + 1)) + 2,
344 (source_width + 1) / 2); 345 (source_width + 1) / 2);
345 346
346 int source_y_width = source_y_right - source_y_left; 347 int source_y_width = source_y_right - source_y_left;
347 int source_uv_width = source_uv_right - source_uv_left; 348 int source_uv_width = source_uv_right - source_uv_left;
348 349
349 // Determine number of pixels in each output row. 350 // Determine number of pixels in each output row.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 else 535 else
535 convert_proc = &ConvertYUVToRGB32_C; 536 convert_proc = &ConvertYUVToRGB32_C;
536 } 537 }
537 538
538 convert_proc(yplane, uplane, vplane, rgbframe, 539 convert_proc(yplane, uplane, vplane, rgbframe,
539 width, height, ystride, uvstride, rgbstride, yuv_type); 540 width, height, ystride, uvstride, rgbstride, yuv_type);
540 #endif 541 #endif
541 } 542 }
542 543
543 } // namespace media 544 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | remoting/base/decoder_vp8.h » ('j') | remoting/base/util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698