OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #ifndef TEST_CODEC_FACTORY_H_ | 10 #ifndef TEST_CODEC_FACTORY_H_ |
11 #define TEST_CODEC_FACTORY_H_ | 11 #define TEST_CODEC_FACTORY_H_ |
12 | 12 |
13 #include "./vpx_config.h" | 13 #include "./vpx_config.h" |
14 #include "vpx/vpx_decoder.h" | 14 #include "vpx/vpx_decoder.h" |
15 #include "vpx/vpx_encoder.h" | 15 #include "vpx/vpx_encoder.h" |
16 #if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER | 16 #if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER |
17 #include "vpx/vp8cx.h" | 17 #include "vpx/vp8cx.h" |
18 #endif | 18 #endif |
19 #if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER | 19 #if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER || CONFIG_VP10_DECODER |
20 #include "vpx/vp8dx.h" | 20 #include "vpx/vp8dx.h" |
21 #endif | 21 #endif |
22 | 22 |
23 #include "test/decode_test_driver.h" | 23 #include "test/decode_test_driver.h" |
24 #include "test/encode_test_driver.h" | 24 #include "test/encode_test_driver.h" |
25 namespace libvpx_test { | 25 namespace libvpx_test { |
26 | 26 |
27 const int kCodecFactoryParam = 0; | 27 const int kCodecFactoryParam = 0; |
28 | 28 |
29 class CodecFactory { | 29 class CodecFactory { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 return new VP9Encoder(cfg, deadline, init_flags, stats); | 226 return new VP9Encoder(cfg, deadline, init_flags, stats); |
227 #else | 227 #else |
228 return NULL; | 228 return NULL; |
229 #endif | 229 #endif |
230 } | 230 } |
231 | 231 |
232 virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg, | 232 virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg, |
233 int usage) const { | 233 int usage) const { |
234 #if CONFIG_VP9_ENCODER | 234 #if CONFIG_VP9_ENCODER |
235 return vpx_codec_enc_config_default(&vpx_codec_vp9_cx_algo, cfg, usage); | 235 return vpx_codec_enc_config_default(&vpx_codec_vp9_cx_algo, cfg, usage); |
| 236 #elif CONFIG_VP10_ENCODER |
| 237 return vpx_codec_enc_config_default(&vpx_codec_vp10_cx_algo, cfg, usage); |
236 #else | 238 #else |
237 return VPX_CODEC_INCAPABLE; | 239 return VPX_CODEC_INCAPABLE; |
238 #endif | 240 #endif |
239 } | 241 } |
240 }; | 242 }; |
241 | 243 |
242 const libvpx_test::VP9CodecFactory kVP9; | 244 const libvpx_test::VP9CodecFactory kVP9; |
243 | 245 |
244 #define VP9_INSTANTIATE_TEST_CASE(test, ...)\ | 246 #define VP9_INSTANTIATE_TEST_CASE(test, ...)\ |
245 INSTANTIATE_TEST_CASE_P(VP9, test, \ | 247 INSTANTIATE_TEST_CASE_P(VP9, test, \ |
246 ::testing::Combine( \ | 248 ::testing::Combine( \ |
247 ::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \ | 249 ::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \ |
248 &libvpx_test::kVP9)), \ | 250 &libvpx_test::kVP9)), \ |
249 __VA_ARGS__)) | 251 __VA_ARGS__)) |
250 #else | 252 #else |
251 #define VP9_INSTANTIATE_TEST_CASE(test, ...) | 253 #define VP9_INSTANTIATE_TEST_CASE(test, ...) |
252 #endif // CONFIG_VP9 | 254 #endif // CONFIG_VP9 |
253 | 255 |
| 256 /* |
| 257 * VP10 Codec Definitions |
| 258 */ |
| 259 #if CONFIG_VP10 |
| 260 class VP10Decoder : public Decoder { |
| 261 public: |
| 262 VP10Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline) |
| 263 : Decoder(cfg, deadline) {} |
| 264 |
| 265 VP10Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag, |
| 266 unsigned long deadline) // NOLINT |
| 267 : Decoder(cfg, flag, deadline) {} |
| 268 |
| 269 protected: |
| 270 virtual vpx_codec_iface_t* CodecInterface() const { |
| 271 #if CONFIG_VP10_DECODER |
| 272 return &vpx_codec_vp10_dx_algo; |
| 273 #else |
| 274 return NULL; |
| 275 #endif |
| 276 } |
| 277 }; |
| 278 |
| 279 class VP10Encoder : public Encoder { |
| 280 public: |
| 281 VP10Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline, |
| 282 const unsigned long init_flags, TwopassStatsStore *stats) |
| 283 : Encoder(cfg, deadline, init_flags, stats) {} |
| 284 |
| 285 protected: |
| 286 virtual vpx_codec_iface_t* CodecInterface() const { |
| 287 #if CONFIG_VP10_ENCODER |
| 288 return &vpx_codec_vp10_cx_algo; |
| 289 #else |
| 290 return NULL; |
| 291 #endif |
| 292 } |
| 293 }; |
| 294 |
| 295 class VP10CodecFactory : public CodecFactory { |
| 296 public: |
| 297 VP10CodecFactory() : CodecFactory() {} |
| 298 |
| 299 virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg, |
| 300 unsigned long deadline) const { |
| 301 return CreateDecoder(cfg, 0, deadline); |
| 302 } |
| 303 |
| 304 virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg, |
| 305 const vpx_codec_flags_t flags, |
| 306 unsigned long deadline) const { // NOLINT |
| 307 #if CONFIG_VP10_DECODER |
| 308 return new VP10Decoder(cfg, flags, deadline); |
| 309 #else |
| 310 return NULL; |
| 311 #endif |
| 312 } |
| 313 |
| 314 virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg, |
| 315 unsigned long deadline, |
| 316 const unsigned long init_flags, |
| 317 TwopassStatsStore *stats) const { |
| 318 #if CONFIG_VP10_ENCODER |
| 319 return new VP10Encoder(cfg, deadline, init_flags, stats); |
| 320 #else |
| 321 return NULL; |
| 322 #endif |
| 323 } |
| 324 |
| 325 virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg, |
| 326 int usage) const { |
| 327 #if CONFIG_VP10_ENCODER |
| 328 return vpx_codec_enc_config_default(&vpx_codec_vp10_cx_algo, cfg, usage); |
| 329 #else |
| 330 return VPX_CODEC_INCAPABLE; |
| 331 #endif |
| 332 } |
| 333 }; |
| 334 |
| 335 const libvpx_test::VP10CodecFactory kVP10; |
| 336 |
| 337 #define VP10_INSTANTIATE_TEST_CASE(test, ...)\ |
| 338 INSTANTIATE_TEST_CASE_P(VP10, test, \ |
| 339 ::testing::Combine( \ |
| 340 ::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \ |
| 341 &libvpx_test::kVP10)), \ |
| 342 __VA_ARGS__)) |
| 343 #else |
| 344 #define VP10_INSTANTIATE_TEST_CASE(test, ...) |
| 345 #endif // CONFIG_VP10 |
254 | 346 |
255 } // namespace libvpx_test | 347 } // namespace libvpx_test |
256 | |
257 #endif // TEST_CODEC_FACTORY_H_ | 348 #endif // TEST_CODEC_FACTORY_H_ |
OLD | NEW |