Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: source/libvpx/test/decode_test_driver.h

Issue 168343002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: libvpx: Pull from upstream Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/dct16x16_test.cc ('k') | source/libvpx/test/decode_test_driver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 public: 42 public:
43 Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline) 43 Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
44 : cfg_(cfg), deadline_(deadline), init_done_(false) { 44 : cfg_(cfg), deadline_(deadline), init_done_(false) {
45 memset(&decoder_, 0, sizeof(decoder_)); 45 memset(&decoder_, 0, sizeof(decoder_));
46 } 46 }
47 47
48 virtual ~Decoder() { 48 virtual ~Decoder() {
49 vpx_codec_destroy(&decoder_); 49 vpx_codec_destroy(&decoder_);
50 } 50 }
51 51
52 vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, int size); 52 vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, size_t size);
53 53
54 DxDataIterator GetDxData() { 54 DxDataIterator GetDxData() {
55 return DxDataIterator(&decoder_); 55 return DxDataIterator(&decoder_);
56 } 56 }
57 57
58 void set_deadline(unsigned long deadline) { 58 void set_deadline(unsigned long deadline) {
59 deadline_ = deadline; 59 deadline_ = deadline;
60 } 60 }
61 61
62 void Control(int ctrl_id, int arg) { 62 void Control(int ctrl_id, int arg) {
63 InitOnce(); 63 InitOnce();
64 const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg); 64 const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
65 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); 65 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
66 } 66 }
67 67
68 void Control(int ctrl_id, const void *arg) { 68 void Control(int ctrl_id, const void *arg) {
69 InitOnce(); 69 InitOnce();
70 const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg); 70 const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
71 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); 71 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
72 } 72 }
73 73
74 const char* DecodeError() { 74 const char* DecodeError() {
75 const char *detail = vpx_codec_error_detail(&decoder_); 75 const char *detail = vpx_codec_error_detail(&decoder_);
76 return detail ? detail : vpx_codec_error(&decoder_); 76 return detail ? detail : vpx_codec_error(&decoder_);
77 } 77 }
78 78
79 // Passes the external frame buffer information to libvpx.
80 vpx_codec_err_t SetFrameBufferFunctions(
81 vpx_get_frame_buffer_cb_fn_t cb_get,
82 vpx_release_frame_buffer_cb_fn_t cb_release, void *user_priv) {
83 InitOnce();
84 return vpx_codec_set_frame_buffer_functions(
85 &decoder_, cb_get, cb_release, user_priv);
86 }
87
79 protected: 88 protected:
80 virtual const vpx_codec_iface_t* CodecInterface() const = 0; 89 virtual vpx_codec_iface_t* CodecInterface() const = 0;
81 90
82 void InitOnce() { 91 void InitOnce() {
83 if (!init_done_) { 92 if (!init_done_) {
84 const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_, 93 const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_,
85 CodecInterface(), 94 CodecInterface(),
86 &cfg_, 0); 95 &cfg_, 0);
87 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); 96 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
88 init_done_ = true; 97 init_done_ = true;
89 } 98 }
90 } 99 }
(...skipping 22 matching lines...) Expand all
113 explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {} 122 explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {}
114 123
115 virtual ~DecoderTest() {} 124 virtual ~DecoderTest() {}
116 125
117 const CodecFactory *codec_; 126 const CodecFactory *codec_;
118 }; 127 };
119 128
120 } // namespace libvpx_test 129 } // namespace libvpx_test
121 130
122 #endif // TEST_DECODE_TEST_DRIVER_H_ 131 #endif // TEST_DECODE_TEST_DRIVER_H_
OLDNEW
« no previous file with comments | « source/libvpx/test/dct16x16_test.cc ('k') | source/libvpx/test/decode_test_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698