summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 03:20:19 +0000
committerfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 03:20:19 +0000
commit51046488738f8a3fdd7f55fc046a93f89e0294f7 (patch)
treea68976a62f50954b72a6719a6871b760385d5749 /media
parent3a8cfc3291e7b409e1ef15de3339677dab60c2bf (diff)
downloadchromium_src-51046488738f8a3fdd7f55fc046a93f89e0294f7.zip
chromium_src-51046488738f8a3fdd7f55fc046a93f89e0294f7.tar.gz
chromium_src-51046488738f8a3fdd7f55fc046a93f89e0294f7.tar.bz2
YUV scaler do horizontal mirror.
Review URL: http://codereview.chromium.org/106002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/yuv_scale.cc111
-rw-r--r--media/base/yuv_scale.h48
-rw-r--r--media/base/yuv_scale_unittest.cc6
-rw-r--r--media/player/mainfrm.h48
-rw-r--r--media/player/player_wtl.cc18
-rw-r--r--media/player/resource.h9
-rw-r--r--media/player/view.h123
7 files changed, 261 insertions, 102 deletions
diff --git a/media/base/yuv_scale.cc b/media/base/yuv_scale.cc
index 7f39861..be99cac 100644
--- a/media/base/yuv_scale.cc
+++ b/media/base/yuv_scale.cc
@@ -20,37 +20,74 @@ static void ScaleYV12ToRGB32Row(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
- size_t width,
- size_t scaled_width);
+ int width,
+ int scaled_width);
static void HalfYV12ToRGB32Row(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
- size_t width);
+ int width);
+
+extern "C" void ConvertYV12ToRGB32Row(const uint8* y_buf,
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ size_t width);
// Scale a frame of YV12 (aka YUV420) to 32 bit ARGB.
void ScaleYV12ToRGB32(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
- size_t width,
- size_t height,
- size_t scaled_width,
- size_t scaled_height,
+ int width,
+ int height,
+ int scaled_width,
+ int scaled_height,
int y_pitch,
int uv_pitch,
- int rgb_pitch) {
+ int rgb_pitch,
+ Rotate view_rotate) {
+ // Rotations that start at right side of image
+ if ((view_rotate == ROTATE_180) ||
+ (view_rotate == ROTATE_270) ||
+ (view_rotate == MIRROR_ROTATE_0) ||
+ (view_rotate == MIRROR_ROTATE_90)) {
+ y_buf += width - 1;
+ u_buf += width / 2 - 1;
+ v_buf += width / 2 - 1;
+ width = -width;
+ }
+ // Rotations that start at bottom of image
+ if ((view_rotate == ROTATE_90) ||
+ (view_rotate == ROTATE_180) ||
+ (view_rotate == MIRROR_ROTATE_90) ||
+ (view_rotate == MIRROR_ROTATE_180)) {
+ y_buf += (height - 1) * y_pitch;
+ u_buf += (height / 2 - 1) * uv_pitch;
+ v_buf += (height / 2 - 1) * uv_pitch;
+ height = -height;
+ }
+ // Only these rotations are implemented.
+ DCHECK((view_rotate == ROTATE_0) ||
+ (view_rotate == ROTATE_180) ||
+ (view_rotate == MIRROR_ROTATE_0) ||
+ (view_rotate == MIRROR_ROTATE_180));
+
#ifdef _OPENMP
#pragma omp parallel for
#endif
- for (int y = 0; y < static_cast<int>(scaled_height); ++y) {
+ for (int y = 0; y < scaled_height; ++y) {
uint8* dest_pixel = rgb_buf + y * rgb_pitch;
int scaled_y = (y * height / scaled_height);
+
const uint8* y_ptr = y_buf + scaled_y * y_pitch;
const uint8* u_ptr = u_buf + scaled_y / 2 * uv_pitch;
const uint8* v_ptr = v_buf + scaled_y / 2 * uv_pitch;
- if (scaled_width == (width / 2)) {
+ if (scaled_width == width) {
+ ConvertYV12ToRGB32Row(y_ptr, u_ptr, v_ptr,
+ dest_pixel, scaled_width);
+ } else if (scaled_width == (width / 2)) {
HalfYV12ToRGB32Row(y_ptr, u_ptr, v_ptr,
dest_pixel, scaled_width);
} else {
@@ -65,17 +102,43 @@ void ScaleYV16ToRGB32(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
- size_t width,
- size_t height,
- size_t scaled_width,
- size_t scaled_height,
+ int width,
+ int height,
+ int scaled_width,
+ int scaled_height,
int y_pitch,
int uv_pitch,
- int rgb_pitch) {
+ int rgb_pitch,
+ Rotate view_rotate) {
+ // Rotations that start at right side of image
+ if ((view_rotate == ROTATE_180) ||
+ (view_rotate == ROTATE_270) ||
+ (view_rotate == MIRROR_ROTATE_0) ||
+ (view_rotate == MIRROR_ROTATE_90)) {
+ y_buf += width - 1;
+ u_buf += width / 2 - 1;
+ v_buf += width / 2 - 1;
+ width = -width;
+ }
+ // Rotations that start at bottom of image
+ if ((view_rotate == ROTATE_90) ||
+ (view_rotate == ROTATE_180) ||
+ (view_rotate == MIRROR_ROTATE_90) ||
+ (view_rotate == MIRROR_ROTATE_180)) {
+ y_buf += (height - 1) * y_pitch;
+ u_buf += (height - 1) * uv_pitch;
+ v_buf += (height - 1) * uv_pitch;
+ height = -height;
+ }
+ // Only these rotations are implemented.
+ DCHECK((view_rotate == ROTATE_0) ||
+ (view_rotate == ROTATE_180) ||
+ (view_rotate == MIRROR_ROTATE_0) ||
+ (view_rotate == MIRROR_ROTATE_180));
#ifdef _OPENMP
#pragma omp parallel for
#endif
- for (int y = 0; y < static_cast<int>(scaled_height); ++y) {
+ for (int y = 0; y < scaled_height; ++y) {
uint8* dest_pixel = rgb_buf + y * rgb_pitch;
int scaled_y = (y * height / scaled_height);
const uint8* y_ptr = y_buf + scaled_y * y_pitch;
@@ -171,9 +234,9 @@ static uint8 g_rgb_clip_table[kClipOverflow
// Therefore source range is -128 to 384.
// Output clips to unsigned 0 to 255.
static inline uint32 clip(int32 value) {
- DCHECK(((value >> 8) + kClipOverflow) >= 0);
- DCHECK(((value >> 8) + kClipOverflow) <
- (kClipOverflow + kClipTableSize + kClipOverflow));
+// DCHECK(((value >> 8) + kClipOverflow) >= 0);
+// DCHECK(((value >> 8) + kClipOverflow) <
+// (kClipOverflow + kClipTableSize + kClipOverflow));
return static_cast<uint32>(g_rgb_clip_table[((value) >> 8) + kClipOverflow]);
}
@@ -186,11 +249,11 @@ static void ScaleYV12ToRGB32Row(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
- size_t width,
- size_t scaled_width) {
+ int width,
+ int scaled_width) {
int scaled_dx = width * 16 / scaled_width;
int scaled_x = 0;
- for (int32 x = 0; x < static_cast<int32>(scaled_width); ++x) {
+ for (int32 x = 0; x < scaled_width; ++x) {
uint8 u = u_buf[scaled_x >> 5];
uint8 v = v_buf[scaled_x >> 5];
int32 d = static_cast<int32>(u) - 128;
@@ -233,8 +296,8 @@ static void HalfYV12ToRGB32Row(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
- size_t width) {
- for (int32 x = 0; x < static_cast<int32>(width); ++x) {
+ int width) {
+ for (int32 x = 0; x < width; ++x) {
uint8 u = u_buf[x];
uint8 v = v_buf[x];
int32 d = static_cast<int32>(u) - 128;
diff --git a/media/base/yuv_scale.h b/media/base/yuv_scale.h
index f354942..a029664 100644
--- a/media/base/yuv_scale.h
+++ b/media/base/yuv_scale.h
@@ -9,33 +9,57 @@
namespace media {
+// Mirror means flip the image horizontally, as in looking in a mirror.
+// Rotate happens after mirroring.
+
+enum Rotate {
+ ROTATE_0, // Rotation off.
+ ROTATE_90, // Rotate clockwise.
+ ROTATE_180, // Rotate upside down.
+ ROTATE_270, // Rotate counter clockwise.
+ MIRROR_ROTATE_0, // Mirror horizontally.
+ MIRROR_ROTATE_90, // Mirror then Rotate clockwise.
+ MIRROR_ROTATE_180, // Mirror vertically.
+ MIRROR_ROTATE_270, // Transpose.
+};
+
+// Diagram showing origin and direction of source sampling.
+// ->0 4<-
+// 7 3
+//
+// 6 5
+// ->1 2<-
+
+
// Scale a frame of YV12 (aka YUV420) to 32 bit ARGB.
void ScaleYV12ToRGB32(const uint8* yplane,
const uint8* uplane,
const uint8* vplane,
uint8* rgbframe,
- size_t frame_width,
- size_t frame_height,
- size_t scaled_width,
- size_t scaled_height,
+ int frame_width,
+ int frame_height,
+ int scaled_width,
+ int scaled_height,
int ystride,
int uvstride,
- int rgbstride);
+ int rgbstride,
+ Rotate view_rotate);
// Scale a frame of YV16 (aka YUV422) to 32 bit ARGB.
void ScaleYV16ToRGB32(const uint8* yplane,
const uint8* uplane,
const uint8* vplane,
uint8* rgbframe,
- size_t frame_width,
- size_t frame_height,
- size_t scaled_width,
- size_t scaled_height,
+ int frame_width,
+ int frame_height,
+ int scaled_width,
+ int scaled_height,
int ystride,
int uvstride,
- int rgbstride);
-
-#endif // MEDIA_BASE_YUV_SCALE_H_
+ int rgbstride,
+ Rotate view_rotate);
} // namespace media
+#endif // MEDIA_BASE_YUV_SCALE_H_
+
diff --git a/media/base/yuv_scale_unittest.cc b/media/base/yuv_scale_unittest.cc
index f5e2f0d..c81c74f 100644
--- a/media/base/yuv_scale_unittest.cc
+++ b/media/base/yuv_scale_unittest.cc
@@ -68,7 +68,8 @@ TEST(YuvScaleTest, Basic) {
kScaledWidth, kScaledHeight, // Dimensions
kWidth, // YStride
kWidth / 2, // UvStride
- kScaledWidth * kBpp); // RgbStride
+ kScaledWidth * kBpp, // RgbStride
+ media::ROTATE_0);
unsigned int rgb_hash = hash(rgb_scaled_bytes, size_of_rgb_scaled);
@@ -106,7 +107,8 @@ TEST(YV16ScaleTest, Basic) {
kScaledWidth, kScaledHeight, // Dimensions
kWidth, // YStride
kWidth / 2, // UvStride
- kScaledWidth * kBpp); // RgbStride
+ kScaledWidth * kBpp, // RgbStride
+ media::ROTATE_0);
unsigned int rgb_hash = hash(rgb_scaled_bytes, size_of_rgb_scaled);
diff --git a/media/player/mainfrm.h b/media/player/mainfrm.h
index e1c9978..7874a01 100644
--- a/media/player/mainfrm.h
+++ b/media/player/mainfrm.h
@@ -77,7 +77,12 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>,
UIEnable(ID_VIEW_FITTOSCREEN, false); // Not currently implemented.
UIEnable(ID_VIEW_FULLSCREEN, false); // Not currently implemented.
UIEnable(ID_VIEW_PROPERTIES, bEnable);
-
+ UIEnable(ID_VIEW_ROTATE0, true);
+ UIEnable(ID_VIEW_ROTATE90, false);
+ UIEnable(ID_VIEW_ROTATE180, true);
+ UIEnable(ID_VIEW_ROTATE270, false);
+ UIEnable(ID_VIEW_MIRROR_HORIZONTAL, true);
+ UIEnable(ID_VIEW_MIRROR_VERTICAL, true);
UIEnable(ID_PLAY_PLAY_PAUSE, bMovieOpen); // if no movie open.
UIEnable(ID_PLAY_HALFSPEED, true);
UIEnable(ID_PLAY_NORMALSPEED, true);
@@ -207,6 +212,8 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>,
COMMAND_RANGE_HANDLER_EX(ID_VIEW_HALFSIZE, ID_VIEW_FULLSCREEN, OnViewSize)
COMMAND_ID_HANDLER_EX(ID_VIEW_TOOLBAR, OnViewToolBar)
COMMAND_ID_HANDLER_EX(ID_VIEW_STATUS_BAR, OnViewStatusBar)
+ COMMAND_RANGE_HANDLER_EX(ID_VIEW_ROTATE0, ID_VIEW_MIRROR_VERTICAL,
+ OnViewRotate)
COMMAND_ID_HANDLER_EX(ID_VIEW_PROPERTIES, OnViewProperties)
COMMAND_ID_HANDLER_EX(ID_PLAY_PLAY_PAUSE, OnPlayPlayPause)
COMMAND_RANGE_HANDLER_EX(ID_PLAY_HALFSPEED, ID_PLAY_DOUBLESPEED,
@@ -236,6 +243,12 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>,
UPDATE_ELEMENT(ID_VIEW_FULLSCREEN, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_TOOLBAR, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_STATUS_BAR, UPDUI_MENUPOPUP)
+ UPDATE_ELEMENT(ID_VIEW_ROTATE0, UPDUI_MENUPOPUP)
+ UPDATE_ELEMENT(ID_VIEW_ROTATE90, UPDUI_MENUPOPUP)
+ UPDATE_ELEMENT(ID_VIEW_ROTATE180, UPDUI_MENUPOPUP)
+ UPDATE_ELEMENT(ID_VIEW_ROTATE270, UPDUI_MENUPOPUP)
+ UPDATE_ELEMENT(ID_VIEW_MIRROR_HORIZONTAL, UPDUI_MENUPOPUP)
+ UPDATE_ELEMENT(ID_VIEW_MIRROR_VERTICAL, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_PROPERTIES, UPDUI_MENUPOPUP | UPDUI_TOOLBAR)
UPDATE_ELEMENT(ID_PLAY_PLAY_PAUSE, UPDUI_MENUPOPUP | UPDUI_TOOLBAR)
UPDATE_ELEMENT(ID_PLAY_HALFSPEED, UPDUI_MENUPOPUP)
@@ -260,10 +273,22 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>,
}
void UpdateSpeedUICheck() {
- float play_rate = media::Movie::get()->GetPlayRate();
- UISetCheck(ID_PLAY_HALFSPEED, (play_rate == 0.5f));
- UISetCheck(ID_PLAY_NORMALSPEED, (play_rate == 1.0f));
- UISetCheck(ID_PLAY_DOUBLESPEED, (play_rate == 2.0f));
+ if (media::Movie::get()) {
+ float play_rate = media::Movie::get()->GetPlayRate();
+ UISetCheck(ID_PLAY_HALFSPEED, (play_rate == 0.5f));
+ UISetCheck(ID_PLAY_NORMALSPEED, (play_rate == 1.0f));
+ UISetCheck(ID_PLAY_DOUBLESPEED, (play_rate == 2.0f));
+ }
+ }
+
+ void UpdateRotateUICheck() {
+ int view_rotate = m_view.GetViewRotate();
+ UISetCheck(ID_VIEW_ROTATE0, (view_rotate == 0));
+ UISetCheck(ID_VIEW_ROTATE90, (view_rotate == 1));
+ UISetCheck(ID_VIEW_ROTATE180, (view_rotate == 2));
+ UISetCheck(ID_VIEW_ROTATE270, (view_rotate == 3));
+ UISetCheck(ID_VIEW_MIRROR_HORIZONTAL, (view_rotate == 4));
+ UISetCheck(ID_VIEW_MIRROR_VERTICAL, (view_rotate == 5));
}
int OnCreate(LPCREATESTRUCT /*lpCreateStruct*/) {
@@ -312,6 +337,7 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>,
UISetCheck(ID_PLAY_NORMALSPEED, 1);
UISetCheck(ID_VIEW_TOOLBAR, 1);
UISetCheck(ID_VIEW_STATUS_BAR, 1);
+ UISetCheck(ID_VIEW_ROTATE0, 1);
UISetCheck(ID_OPTIONS_OPENMP, 0);
UISetCheck(ID_OPTIONS_DRAW, 1);
UISetCheck(ID_OPTIONS_AUDIO, 1);
@@ -390,9 +416,9 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>,
void OnFileOpen(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
CFileDialog dlg(TRUE, L"bmp", NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
- L"Movie Files (*.mp4;*.mov;*.mkv;*.flv;*.avi;*.264)\0"
- L"*.mp4;*.mov;*.mkv;*.flv;*.avi;*.264\0"
- L"Bitmap Files (*.bmp)\0*.bmp\0All Files (*.*)\0*.*\0",
+ L"Movie Files (*.mp4;*.ogg;*.ogv)\0"
+ L"*.mp4;*.ogg;*.ogv\0"
+ L"Audio Files (*.mp3;*.m4a)\0*.mp3;*.m4a\0All Files (*.*)\0*.*\0",
m_hWnd);
if (dlg.DoModal() == IDOK) {
MovieOpenFile(dlg.m_szFileName);
@@ -537,6 +563,12 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>,
UpdateLayout();
}
+ void OnViewRotate(UINT /*uNotifyCode*/, int nID, CWindow /*wnd*/) {
+ m_view.SetViewRotate(nID - ID_VIEW_ROTATE0);
+ UpdateRotateUICheck();
+ UpdateLayout();
+ }
+
void OnViewToolBar(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
static BOOL bNew = TRUE; // initially visible
bNew = !bNew;
diff --git a/media/player/player_wtl.cc b/media/player/player_wtl.cc
index 0c2bb6b..26cbaba 100644
--- a/media/player/player_wtl.cc
+++ b/media/player/player_wtl.cc
@@ -14,14 +14,14 @@
// Note this header must come before other ATL headers.
#include "media/player/stdafx.h"
-#include <atlcrack.h>
-#include <atlctrls.h>
-#include <atlctrlw.h>
-#include <atldlgs.h>
-#include <atlframe.h>
-#include <atlmisc.h>
-#include <atlprint.h>
-#include <atlscrl.h>
+#include <atlcrack.h> // NOLINT
+#include <atlctrls.h> // NOLINT
+#include <atlctrlw.h> // NOLINT
+#include <atldlgs.h> // NOLINT
+#include <atlframe.h> // NOLINT
+#include <atlmisc.h> // NOLINT
+#include <atlprint.h> // NOLINT
+#include <atlscrl.h> // NOLINT
// Note these headers are order sensitive.
#include "base/at_exit.h"
@@ -45,6 +45,7 @@
CAppModule g_module;
int Run(wchar_t* cmd_line, int cmd_show) {
+ base::AtExitManager exit_manager;
CMessageLoop the_loop;
g_module.AddMessageLoop(&the_loop);
@@ -56,7 +57,6 @@ int Run(wchar_t* cmd_line, int cmd_show) {
wnd_main.ShowWindow(cmd_show);
- base::AtExitManager exit_manager;
wchar_t* url = NULL;
if (cmd_line && *cmd_line) {
diff --git a/media/player/resource.h b/media/player/resource.h
index d009d7b..ee8f260 100644
--- a/media/player/resource.h
+++ b/media/player/resource.h
@@ -43,13 +43,20 @@
#define ID_PLAY_NORMALSPEED 32802
#define ID_PLAY_DOUBLESPEED 32803
#define ID_FILE_LAST 32804
+#define ID_Menu32806 32806
+#define ID_VIEW_ROTATE0 32807
+#define ID_VIEW_ROTATE90 32808
+#define ID_VIEW_ROTATE180 32809
+#define ID_VIEW_ROTATE270 32810
+#define ID_VIEW_MIRROR_HORIZONTAL 32811
+#define ID_VIEW_MIRROR_VERTICAL 32812
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 203
-#define _APS_NEXT_COMMAND_VALUE 32806
+#define _APS_NEXT_COMMAND_VALUE 32813
#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_SYMED_VALUE 101
#endif
diff --git a/media/player/view.h b/media/player/view.h
index 4c72512..f515c16 100644
--- a/media/player/view.h
+++ b/media/player/view.h
@@ -54,6 +54,7 @@ class WtlVideoWindow : public CScrollWindowImpl<WtlVideoWindow> {
size_.cx = 0;
size_.cy = 0;
view_size_ = 1;
+ view_rotate_ = media::ROTATE_0;
renderer_ = new WtlVideoRenderer(this);
last_frame_ = NULL;
hbmp_ = NULL;
@@ -295,6 +296,56 @@ class WtlVideoWindow : public CScrollWindowImpl<WtlVideoWindow> {
return view_size_;
}
+ void SetViewRotate(int view_rotate) {
+ switch (view_rotate) {
+ default:
+ case 0:
+ view_rotate_ = media::ROTATE_0;
+ break;
+ case 1:
+ view_rotate_ = media::ROTATE_90;
+ break;
+ case 2:
+ view_rotate_ = media::ROTATE_180;
+ break;
+ case 3:
+ view_rotate_ = media::ROTATE_270;
+ break;
+ case 4:
+ view_rotate_ = media::MIRROR_ROTATE_0;
+ break;
+ case 5:
+ view_rotate_ = media::MIRROR_ROTATE_180;
+ break;
+ }
+ }
+
+ int GetViewRotate() {
+ int view_rotate = 0;
+ switch (view_rotate_) {
+ default:
+ case media::ROTATE_0:
+ view_rotate = 0;
+ break;
+ case media::ROTATE_90:
+ view_rotate = 1;
+ break;
+ case media::ROTATE_180:
+ view_rotate = 2;
+ break;
+ case media::ROTATE_270:
+ view_rotate = 3;
+ break;
+ case media::MIRROR_ROTATE_0:
+ view_rotate = 4;
+ break;
+ case media::MIRROR_ROTATE_180:
+ view_rotate = 5;
+ break;
+ }
+ return view_rotate;
+ }
+
void SetBitmap(HBITMAP hbmp) {
hbmp_ = hbmp;
}
@@ -307,6 +358,9 @@ class WtlVideoWindow : public CScrollWindowImpl<WtlVideoWindow> {
HBITMAP hbmp_; // For Images
int view_size_; // View Size. 0=0.5, 1=normal, 2=2x, 3=fit, 4=full
+ // View Rotate 0-5 for ID_VIEW_ROTATE0 to ID_VIEW_MIRROR_VERTICAL
+ media::Rotate view_rotate_;
+
// Draw a frame of YUV to an RGB buffer with scaling.
// Handles different YUV formats.
void DrawYUV(const media::VideoSurface &frame_in,
@@ -316,53 +370,30 @@ class WtlVideoWindow : public CScrollWindowImpl<WtlVideoWindow> {
int clipped_height,
int scaled_width,
int scaled_height) {
- // Normal size
- if (view_size_ == 1) {
- if (frame_in.format == media::VideoSurface::YV16) {
- // Temporary cast, til we use uint8 for VideoFrame.
- media::ConvertYV16ToRGB32((const uint8*)frame_in.data[0],
- (const uint8*)frame_in.data[1],
- (const uint8*)frame_in.data[2],
- movie_dib_bits,
- clipped_width, clipped_height,
- frame_in.strides[0],
- frame_in.strides[1],
- dibrowbytes);
- } else {
- // Temporary cast, til we use uint8 for VideoFrame.
- media::ConvertYV12ToRGB32((const uint8*)frame_in.data[0],
- (const uint8*)frame_in.data[1],
- (const uint8*)frame_in.data[2],
- movie_dib_bits,
- clipped_width, clipped_height,
- frame_in.strides[0],
- frame_in.strides[1],
- dibrowbytes);
- }
+ if (frame_in.format == media::VideoSurface::YV16) {
+ // Temporary cast, til we use uint8 for VideoFrame.
+ media::ScaleYV16ToRGB32(frame_in.data[0],
+ frame_in.data[1],
+ frame_in.data[2],
+ movie_dib_bits,
+ clipped_width, clipped_height,
+ scaled_width, scaled_height,
+ frame_in.strides[0],
+ frame_in.strides[1],
+ dibrowbytes,
+ view_rotate_);
} else {
- if (frame_in.format == media::VideoSurface::YV16) {
- // Temporary cast, til we use uint8 for VideoFrame.
- media::ScaleYV16ToRGB32((const uint8*)frame_in.data[0],
- (const uint8*)frame_in.data[1],
- (const uint8*)frame_in.data[2],
- movie_dib_bits,
- clipped_width, clipped_height,
- scaled_width, scaled_height,
- frame_in.strides[0],
- frame_in.strides[1],
- dibrowbytes);
- } else {
- // Temporary cast, til we use uint8 for VideoFrame.
- media::ScaleYV12ToRGB32((const uint8*)frame_in.data[0],
- (const uint8*)frame_in.data[1],
- (const uint8*)frame_in.data[2],
- movie_dib_bits,
- clipped_width, clipped_height,
- scaled_width, scaled_height,
- frame_in.strides[0],
- frame_in.strides[1],
- dibrowbytes);
- }
+ // Temporary cast, til we use uint8 for VideoFrame.
+ media::ScaleYV12ToRGB32(frame_in.data[0],
+ frame_in.data[1],
+ frame_in.data[2],
+ movie_dib_bits,
+ clipped_width, clipped_height,
+ scaled_width, scaled_height,
+ frame_in.strides[0],
+ frame_in.strides[1],
+ dibrowbytes,
+ view_rotate_);
}
}