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

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

Issue 111463005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years 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/decode_perf_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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SetExternalFrameBuffers(
81 vpx_codec_frame_buffer_t *fb_list, int fb_count,
82 vpx_realloc_frame_buffer_cb_fn_t cb, void *user_priv) {
83 InitOnce();
84 return vpx_codec_set_frame_buffers(&decoder_,
85 fb_list, fb_count,
86 cb, user_priv);
87 }
88
79 protected: 89 protected:
80 virtual const vpx_codec_iface_t* CodecInterface() const = 0; 90 virtual const vpx_codec_iface_t* CodecInterface() const = 0;
81 91
82 void InitOnce() { 92 void InitOnce() {
83 if (!init_done_) { 93 if (!init_done_) {
84 const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_, 94 const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_,
85 CodecInterface(), 95 CodecInterface(),
86 &cfg_, 0); 96 &cfg_, 0);
87 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); 97 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
88 init_done_ = true; 98 init_done_ = true;
89 } 99 }
90 } 100 }
91 101
92 vpx_codec_ctx_t decoder_; 102 vpx_codec_ctx_t decoder_;
93 vpx_codec_dec_cfg_t cfg_; 103 vpx_codec_dec_cfg_t cfg_;
94 unsigned int deadline_; 104 unsigned int deadline_;
95 bool init_done_; 105 bool init_done_;
96 }; 106 };
97 107
98 // Common test functionality for all Decoder tests. 108 // Common test functionality for all Decoder tests.
99 class DecoderTest { 109 class DecoderTest {
100 public: 110 public:
101 // Main decoding loop 111 // Main decoding loop
102 virtual void RunLoop(CompressedVideoSource *video); 112 virtual void RunLoop(CompressedVideoSource *video);
103 113
114 // Hook to be called before decompressing every frame.
115 virtual void PreDecodeFrameHook(const CompressedVideoSource& video,
116 Decoder *decoder) {}
117
104 // Hook to be called on every decompressed frame. 118 // Hook to be called on every decompressed frame.
105 virtual void DecompressedFrameHook(const vpx_image_t& img, 119 virtual void DecompressedFrameHook(const vpx_image_t& img,
106 const unsigned int frame_number) {} 120 const unsigned int frame_number) {}
107 121
108 protected: 122 protected:
109 explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {} 123 explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {}
110 124
111 virtual ~DecoderTest() {} 125 virtual ~DecoderTest() {}
112 126
113 const CodecFactory *codec_; 127 const CodecFactory *codec_;
114 }; 128 };
115 129
116 } // namespace libvpx_test 130 } // namespace libvpx_test
117 131
118 #endif // TEST_DECODE_TEST_DRIVER_H_ 132 #endif // TEST_DECODE_TEST_DRIVER_H_
OLDNEW
« no previous file with comments | « source/libvpx/test/decode_perf_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