summaryrefslogtreecommitdiffstats
path: root/remoting/codec/codec_test.cc
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-22 10:19:20 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-22 10:19:20 +0000
commit8a4541fc6c5749ddf6d6bed49a4c69a897ff006f (patch)
tree2916ecb8ca9f19ebe1df995b20ec01fc673d89b3 /remoting/codec/codec_test.cc
parent1c4582423ff5aa1776deef53bbd0c11c1f0bc354 (diff)
downloadchromium_src-8a4541fc6c5749ddf6d6bed49a4c69a897ff006f.zip
chromium_src-8a4541fc6c5749ddf6d6bed49a4c69a897ff006f.tar.gz
chromium_src-8a4541fc6c5749ddf6d6bed49a4c69a897ff006f.tar.bz2
Simplify remoting::CaptureData
1. Previously CaptureData had pixel_format() field but we only use that class for RGB. Removed that field. 2. Removed DataPlanes because it's doesn't make sense for RGB32. Instead CaptureData class now stored data pointer and stride values. TBR=tsepez@chromium.org Review URL: https://chromiumcodereview.appspot.com/11637031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174519 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/codec/codec_test.cc')
-rw-r--r--remoting/codec/codec_test.cc36
1 files changed, 10 insertions, 26 deletions
diff --git a/remoting/codec/codec_test.cc b/remoting/codec/codec_test.cc
index fb2d1a6..7f45828 100644
--- a/remoting/codec/codec_test.cc
+++ b/remoting/codec/codec_test.cc
@@ -204,10 +204,10 @@ class VideoDecoderTester {
EXPECT_EQ(expected_region_, update_region_);
for (SkRegion::Iterator i(update_region_); !i.done(); i.next()) {
const int stride = view_size_.width() * kBytesPerPixel;
- EXPECT_EQ(stride, capture_data_->data_planes().strides[0]);
+ EXPECT_EQ(stride, capture_data_->stride());
const int offset = stride * i.rect().top() +
kBytesPerPixel * i.rect().left();
- const uint8* original = capture_data_->data_planes().data[0] + offset;
+ const uint8* original = capture_data_->data() + offset;
const uint8* decoded = image_data_.get() + offset;
const int row_size = kBytesPerPixel * i.rect().width();
for (int y = 0; y < i.rect().height(); ++y) {
@@ -318,10 +318,7 @@ class VideoEncoderTester {
};
scoped_refptr<CaptureData> PrepareEncodeData(const SkISize& size,
- media::VideoFrame::Format format,
scoped_array<uint8>* memory) {
- // TODO(hclam): Support also YUV format.
- CHECK_EQ(format, media::VideoFrame::RGB32);
int memory_size = size.width() * size.height() * kBytesPerPixel;
memory->reset(new uint8[memory_size]);
@@ -331,14 +328,8 @@ scoped_refptr<CaptureData> PrepareEncodeData(const SkISize& size,
(*memory)[i] = rand() % 256;
}
- DataPlanes planes;
- memset(planes.data, 0, sizeof(planes.data));
- memset(planes.strides, 0, sizeof(planes.strides));
- planes.data[0] = memory->get();
- planes.strides[0] = size.width() * kBytesPerPixel;
-
scoped_refptr<CaptureData> data =
- new CaptureData(planes, size, format);
+ new CaptureData(memory->get(), size.width() * kBytesPerPixel, size);
return data;
}
@@ -370,7 +361,7 @@ void TestVideoEncoder(VideoEncoder* encoder, bool strict) {
for (size_t yi = 0; yi < arraysize(kSizes); ++yi) {
SkISize size = SkISize::Make(kSizes[xi], kSizes[yi]);
scoped_refptr<CaptureData> data =
- PrepareEncodeData(size, media::VideoFrame::RGB32, &memory);
+ PrepareEncodeData(size, &memory);
std::vector<std::vector<SkIRect> > test_rect_lists =
MakeTestRectLists(size);
for (size_t i = 0; i < test_rect_lists.size(); ++i) {
@@ -394,16 +385,15 @@ static void TestEncodeDecodeRects(VideoEncoder* encoder,
// Generate random data for the updated region.
srand(0);
for (int i = 0; i < count; ++i) {
- CHECK_EQ(data->pixel_format(), media::VideoFrame::RGB32);
const int bytes_per_pixel = 4; // Because of RGB32 on previous line.
const int row_size = bytes_per_pixel * rects[i].width();
- uint8* memory = data->data_planes().data[0] +
- data->data_planes().strides[0] * rects[i].top() +
+ uint8* memory = data->data() +
+ data->stride() * rects[i].top() +
bytes_per_pixel * rects[i].left();
for (int y = 0; y < rects[i].height(); ++y) {
for (int x = 0; x < row_size; ++x)
memory[x] = rand() % 256;
- memory += data->data_planes().strides[0];
+ memory += data->stride();
}
}
@@ -423,8 +413,7 @@ void TestVideoEncoderDecoder(
VideoEncoderTester encoder_tester(&message_tester);
scoped_array<uint8> memory;
- scoped_refptr<CaptureData> data =
- PrepareEncodeData(kSize, media::VideoFrame::RGB32, &memory);
+ scoped_refptr<CaptureData> data = PrepareEncodeData(kSize, &memory);
VideoDecoderTester decoder_tester(decoder, kSize, kSize);
decoder_tester.set_strict(strict);
@@ -469,14 +458,9 @@ void TestVideoEncoderDecoderGradient(VideoEncoder* encoder,
view_size.width() * view_size.height() * kBytesPerPixel]);
FillWithGradient(expected_view_data.get(), view_size, view_rect);
- DataPlanes planes;
- memset(planes.data, 0, sizeof(planes.data));
- memset(planes.strides, 0, sizeof(planes.strides));
- planes.data[0] = screen_data.get();
- planes.strides[0] = screen_size.width() * kBytesPerPixel;
-
scoped_refptr<CaptureData> capture_data =
- new CaptureData(planes, screen_size, media::VideoFrame::RGB32);
+ new CaptureData(screen_data.get(), screen_size.width() * kBytesPerPixel,
+ screen_size);
capture_data->mutable_dirty_region().op(screen_rect, SkRegion::kUnion_Op);
VideoDecoderTester decoder_tester(decoder, screen_size, view_size);