Update broken references to image assets
[chromium-blink-merge.git] / remoting / codec / video_decoder_vpx_unittest.cc
bloba7f2530b9e93b827b1a865faa86b5093c5bccf72
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "remoting/codec/video_decoder_vpx.h"
7 #include "media/base/video_frame.h"
8 #include "remoting/codec/codec_test.h"
9 #include "remoting/codec/video_encoder_vpx.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
13 namespace remoting {
15 namespace {
17 class VideoDecoderVpxTest : public testing::Test {
18 protected:
19 scoped_ptr<VideoEncoderVpx> encoder_;
20 scoped_ptr<VideoDecoderVpx> decoder_;
22 VideoDecoderVpxTest() : encoder_(VideoEncoderVpx::CreateForVP8()),
23 decoder_(VideoDecoderVpx::CreateForVP8()) {
26 void TestGradient(int screen_width, int screen_height,
27 double max_error_limit, double mean_error_limit) {
28 TestVideoEncoderDecoderGradient(
29 encoder_.get(), decoder_.get(),
30 webrtc::DesktopSize(screen_width, screen_height),
31 max_error_limit, mean_error_limit);
35 class VideoDecoderVp8Test : public VideoDecoderVpxTest {
36 protected:
37 VideoDecoderVp8Test() {
38 encoder_ = VideoEncoderVpx::CreateForVP8();
39 decoder_ = VideoDecoderVpx::CreateForVP8();
43 class VideoDecoderVp9Test : public VideoDecoderVpxTest {
44 protected:
45 VideoDecoderVp9Test() {
46 encoder_ = VideoEncoderVpx::CreateForVP9();
47 decoder_ = VideoDecoderVpx::CreateForVP9();
51 } // namespace
54 // Test the VP8 codec.
57 TEST_F(VideoDecoderVp8Test, VideoEncodeAndDecode) {
58 TestVideoEncoderDecoder(encoder_.get(), decoder_.get(), false);
61 // Check that encoding and decoding a particular frame doesn't change the
62 // frame too much. The frame used is a gradient, which does not contain sharp
63 // transitions, so encoding lossiness should not be too high.
64 TEST_F(VideoDecoderVp8Test, Gradient) {
65 TestGradient(320, 240, 0.04, 0.02);
69 // Test the VP9 codec.
72 TEST_F(VideoDecoderVp9Test, VideoEncodeAndDecode) {
73 TestVideoEncoderDecoder(encoder_.get(), decoder_.get(), false);
76 // Check that encoding and decoding a particular frame doesn't change the
77 // frame too much. The frame used is a gradient, which does not contain sharp
78 // transitions, so encoding lossiness should not be too high.
79 TEST_F(VideoDecoderVp9Test, Gradient) {
80 TestGradient(320, 240, 0.04, 0.02);
83 } // namespace remoting