From bdde9f26ec7c21e7d1d5d8f56c35063b6846efe6 Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" Date: Thu, 2 Dec 2010 00:20:19 +0000 Subject: Reverse rows in VP8 decoder. TEST=None BUG=None Review URL: http://codereview.chromium.org/5310011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67918 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/base/decoder_vp8.cc | 16 +++++++++++----- remoting/base/decoder_vp8.h | 3 +++ 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'remoting/base') diff --git a/remoting/base/decoder_vp8.cc b/remoting/base/decoder_vp8.cc index 516e9f4..fc89503 100644 --- a/remoting/base/decoder_vp8.cc +++ b/remoting/base/decoder_vp8.cc @@ -18,7 +18,8 @@ extern "C" { namespace remoting { DecoderVp8::DecoderVp8() - : state_(kUninitialized), + : reverse_rows_(true), + state_(kUninitialized), codec_(NULL) { } @@ -82,11 +83,16 @@ Decoder::DecodeResult DecoderVp8::DecodePacket(const VideoPacket* packet) { } // Perform YUV conversion. + uint8* data_start = frame_->data(media::VideoFrame::kRGBPlane); + int stride = frame_->stride(media::VideoFrame::kRGBPlane); + if (reverse_rows_) { + data_start = data_start + (frame_->height() - 1) * stride; + stride = -stride; + } + media::ConvertYUVToRGB32(image->planes[0], image->planes[1], image->planes[2], - frame_->data(media::VideoFrame::kRGBPlane), - frame_->width(), frame_->height(), - image->stride[0], image->stride[1], - frame_->stride(media::VideoFrame::kRGBPlane), + data_start, frame_->width(), frame_->height(), + image->stride[0], image->stride[1], stride, media::YV12); return DECODE_DONE; } diff --git a/remoting/base/decoder_vp8.h b/remoting/base/decoder_vp8.h index ebe082a..a59a601 100644 --- a/remoting/base/decoder_vp8.h +++ b/remoting/base/decoder_vp8.h @@ -31,6 +31,9 @@ class DecoderVp8 : public Decoder { kError, }; + // True if we should decode the image upside down. + bool reverse_rows_; + // The internal state of the decoder. State state_; -- cgit v1.1