OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 const EncodePerfTestVideo kVP9EncodePerfTestVectors[] = { | 58 const EncodePerfTestVideo kVP9EncodePerfTestVectors[] = { |
59 {"niklas_1280_720_30.yuv", 1280, 720, 600, 10}, | 59 {"niklas_1280_720_30.yuv", 1280, 720, 600, 10}, |
60 }; | 60 }; |
61 | 61 |
62 struct EncodeParameters { | 62 struct EncodeParameters { |
63 int32_t tile_rows; | 63 int32_t tile_rows; |
64 int32_t tile_cols; | 64 int32_t tile_cols; |
65 int32_t lossless; | 65 int32_t lossless; |
66 int32_t error_resilient; | 66 int32_t error_resilient; |
67 int32_t frame_parallel; | 67 int32_t frame_parallel; |
| 68 vpx_color_space_t cs; |
68 // TODO(JBB): quantizers / bitrate | 69 // TODO(JBB): quantizers / bitrate |
69 }; | 70 }; |
70 | 71 |
71 const EncodeParameters kVP9EncodeParameterSet[] = { | 72 const EncodeParameters kVP9EncodeParameterSet[] = { |
72 {0, 0, 0, 1, 0}, | 73 {0, 0, 0, 1, 0, VPX_CS_BT_601}, |
73 {0, 0, 0, 0, 0}, | 74 {0, 0, 0, 0, 0, VPX_CS_BT_709}, |
74 {0, 0, 1, 0, 0}, | 75 {0, 0, 1, 0, 0, VPX_CS_BT_2020}, |
75 {0, 2, 0, 0, 1}, | 76 {0, 2, 0, 0, 1, VPX_CS_UNKNOWN}, |
76 // TODO(JBB): Test profiles (requires more work). | 77 // TODO(JBB): Test profiles (requires more work). |
77 }; | 78 }; |
78 | 79 |
79 int is_extension_y4m(const char *filename) { | 80 int is_extension_y4m(const char *filename) { |
80 const char *dot = strrchr(filename, '.'); | 81 const char *dot = strrchr(filename, '.'); |
81 if (!dot || dot == filename) | 82 if (!dot || dot == filename) |
82 return 0; | 83 return 0; |
83 else | 84 else |
84 return !strcmp(dot, ".y4m"); | 85 return !strcmp(dot, ".y4m"); |
85 } | 86 } |
(...skipping 16 matching lines...) Expand all Loading... |
102 cfg_.g_lag_in_frames = 25; | 103 cfg_.g_lag_in_frames = 25; |
103 cfg_.g_error_resilient = encode_parms.error_resilient; | 104 cfg_.g_error_resilient = encode_parms.error_resilient; |
104 dec_cfg_.threads = 4; | 105 dec_cfg_.threads = 4; |
105 test_video_ = GET_PARAM(2); | 106 test_video_ = GET_PARAM(2); |
106 cfg_.rc_target_bitrate = test_video_.bitrate; | 107 cfg_.rc_target_bitrate = test_video_.bitrate; |
107 } | 108 } |
108 | 109 |
109 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, | 110 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, |
110 ::libvpx_test::Encoder *encoder) { | 111 ::libvpx_test::Encoder *encoder) { |
111 if (video->frame() == 1) { | 112 if (video->frame() == 1) { |
| 113 encoder->Control(VP9E_SET_COLOR_SPACE, encode_parms.cs); |
112 encoder->Control(VP9E_SET_LOSSLESS, encode_parms.lossless); | 114 encoder->Control(VP9E_SET_LOSSLESS, encode_parms.lossless); |
113 encoder->Control(VP9E_SET_FRAME_PARALLEL_DECODING, | 115 encoder->Control(VP9E_SET_FRAME_PARALLEL_DECODING, |
114 encode_parms.frame_parallel); | 116 encode_parms.frame_parallel); |
115 encoder->Control(VP9E_SET_TILE_ROWS, encode_parms.tile_rows); | 117 encoder->Control(VP9E_SET_TILE_ROWS, encode_parms.tile_rows); |
116 encoder->Control(VP9E_SET_TILE_COLUMNS, encode_parms.tile_cols); | 118 encoder->Control(VP9E_SET_TILE_COLUMNS, encode_parms.tile_cols); |
117 encoder->Control(VP8E_SET_CPUUSED, kCpuUsed); | 119 encoder->Control(VP8E_SET_CPUUSED, kCpuUsed); |
118 encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1); | 120 encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1); |
119 encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7); | 121 encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7); |
120 encoder->Control(VP8E_SET_ARNR_STRENGTH, 5); | 122 encoder->Control(VP8E_SET_ARNR_STRENGTH, 5); |
121 encoder->Control(VP8E_SET_ARNR_TYPE, 3); | 123 encoder->Control(VP8E_SET_ARNR_TYPE, 3); |
(...skipping 18 matching lines...) Expand all Loading... |
140 EXPECT_EQ(common->tx_mode, ONLY_4X4); | 142 EXPECT_EQ(common->tx_mode, ONLY_4X4); |
141 } | 143 } |
142 EXPECT_EQ(common->error_resilient_mode, encode_parms.error_resilient); | 144 EXPECT_EQ(common->error_resilient_mode, encode_parms.error_resilient); |
143 if (encode_parms.error_resilient) { | 145 if (encode_parms.error_resilient) { |
144 EXPECT_EQ(common->frame_parallel_decoding_mode, 1); | 146 EXPECT_EQ(common->frame_parallel_decoding_mode, 1); |
145 EXPECT_EQ(common->use_prev_frame_mvs, 0); | 147 EXPECT_EQ(common->use_prev_frame_mvs, 0); |
146 } else { | 148 } else { |
147 EXPECT_EQ(common->frame_parallel_decoding_mode, | 149 EXPECT_EQ(common->frame_parallel_decoding_mode, |
148 encode_parms.frame_parallel); | 150 encode_parms.frame_parallel); |
149 } | 151 } |
150 | 152 EXPECT_EQ(common->color_space, encode_parms.cs); |
151 EXPECT_EQ(common->log2_tile_cols, encode_parms.tile_cols); | 153 EXPECT_EQ(common->log2_tile_cols, encode_parms.tile_cols); |
152 EXPECT_EQ(common->log2_tile_rows, encode_parms.tile_rows); | 154 EXPECT_EQ(common->log2_tile_rows, encode_parms.tile_rows); |
153 | 155 |
154 EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError(); | 156 EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError(); |
155 return VPX_CODEC_OK == res_dec; | 157 return VPX_CODEC_OK == res_dec; |
156 } | 158 } |
157 | 159 |
158 EncodePerfTestVideo test_video_; | 160 EncodePerfTestVideo test_video_; |
159 | 161 |
160 private: | 162 private: |
(...skipping 19 matching lines...) Expand all Loading... |
180 ASSERT_NO_FATAL_FAILURE(RunLoop(video)); | 182 ASSERT_NO_FATAL_FAILURE(RunLoop(video)); |
181 delete(video); | 183 delete(video); |
182 } | 184 } |
183 | 185 |
184 VP9_INSTANTIATE_TEST_CASE( | 186 VP9_INSTANTIATE_TEST_CASE( |
185 Vp9EncoderParmsGetToDecoder, | 187 Vp9EncoderParmsGetToDecoder, |
186 ::testing::ValuesIn(kVP9EncodeParameterSet), | 188 ::testing::ValuesIn(kVP9EncodeParameterSet), |
187 ::testing::ValuesIn(kVP9EncodePerfTestVectors)); | 189 ::testing::ValuesIn(kVP9EncodePerfTestVectors)); |
188 | 190 |
189 } // namespace | 191 } // namespace |
OLD | NEW |