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

Unified Diff: media/base/video_util.cc

Issue 10830110: Remove VideoDecoderConfig::aspect_ratio_xxx methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments & rebased Created 8 years, 5 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 | « media/base/video_util.h ('k') | media/ffmpeg/ffmpeg_common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_util.cc
diff --git a/media/base/video_util.cc b/media/base/video_util.cc
index 4476e6d0693e3934ec99f75392fcf610eba15ea1..4bef0adc88b1e92a17ff0e3e9fe3543ac646fce9 100644
--- a/media/base/video_util.cc
+++ b/media/base/video_util.cc
@@ -4,11 +4,32 @@
#include "media/base/video_util.h"
+#include <cmath>
+
#include "base/logging.h"
#include "media/base/video_frame.h"
namespace media {
+gfx::Size GetNaturalSize(const gfx::Size& visible_size,
+ int aspect_ratio_numerator,
+ int aspect_ratio_denominator) {
+ if (aspect_ratio_denominator == 0 ||
+ aspect_ratio_numerator < 0 ||
+ aspect_ratio_denominator < 0)
+ return gfx::Size();
+
+ double aspect_ratio = aspect_ratio_numerator /
+ static_cast<double>(aspect_ratio_denominator);
+
+ int width = floor(visible_size.width() * aspect_ratio + 0.5);
+ int height = visible_size.height();
+
+ // An even width makes things easier for YV12 and appears to be the behavior
+ // expected by WebKit layout tests.
+ return gfx::Size(width & ~1, height);
+}
+
static void CopyPlane(size_t plane, const uint8* source, int stride, int rows,
VideoFrame* frame) {
uint8* dest = frame->data(plane);
« no previous file with comments | « media/base/video_util.h ('k') | media/ffmpeg/ffmpeg_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698