OLD | NEW |
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 #ifndef TEST_ENCODE_TEST_DRIVER_H_ | 10 #ifndef TEST_ENCODE_TEST_DRIVER_H_ |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 virtual ~Encoder() { | 99 virtual ~Encoder() { |
100 vpx_codec_destroy(&encoder_); | 100 vpx_codec_destroy(&encoder_); |
101 } | 101 } |
102 | 102 |
103 CxDataIterator GetCxData() { | 103 CxDataIterator GetCxData() { |
104 return CxDataIterator(&encoder_); | 104 return CxDataIterator(&encoder_); |
105 } | 105 } |
106 | 106 |
| 107 void InitEncoder(VideoSource *video); |
| 108 |
107 const vpx_image_t *GetPreviewFrame() { | 109 const vpx_image_t *GetPreviewFrame() { |
108 return vpx_codec_get_preview_frame(&encoder_); | 110 return vpx_codec_get_preview_frame(&encoder_); |
109 } | 111 } |
110 // This is a thin wrapper around vpx_codec_encode(), so refer to | 112 // This is a thin wrapper around vpx_codec_encode(), so refer to |
111 // vpx_encoder.h for its semantics. | 113 // vpx_encoder.h for its semantics. |
112 void EncodeFrame(VideoSource *video, const unsigned long frame_flags); | 114 void EncodeFrame(VideoSource *video, const unsigned long frame_flags); |
113 | 115 |
114 // Convenience wrapper for EncodeFrame() | 116 // Convenience wrapper for EncodeFrame() |
115 void EncodeFrame(VideoSource *video) { | 117 void EncodeFrame(VideoSource *video) { |
116 EncodeFrame(video, 0); | 118 EncodeFrame(video, 0); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 last_pts_(0) {} | 180 last_pts_(0) {} |
179 | 181 |
180 virtual ~EncoderTest() {} | 182 virtual ~EncoderTest() {} |
181 | 183 |
182 // Initialize the cfg_ member with the default configuration. | 184 // Initialize the cfg_ member with the default configuration. |
183 void InitializeConfig(); | 185 void InitializeConfig(); |
184 | 186 |
185 // Map the TestMode enum to the deadline_ and passes_ variables. | 187 // Map the TestMode enum to the deadline_ and passes_ variables. |
186 void SetMode(TestMode mode); | 188 void SetMode(TestMode mode); |
187 | 189 |
| 190 // Set encoder flag. |
| 191 void set_init_flags(unsigned long flag) { // NOLINT(runtime/int) |
| 192 init_flags_ = flag; |
| 193 } |
| 194 |
188 // Main loop | 195 // Main loop |
189 virtual void RunLoop(VideoSource *video); | 196 virtual void RunLoop(VideoSource *video); |
190 | 197 |
191 // Hook to be called at the beginning of a pass. | 198 // Hook to be called at the beginning of a pass. |
192 virtual void BeginPassHook(unsigned int /*pass*/) {} | 199 virtual void BeginPassHook(unsigned int /*pass*/) {} |
193 | 200 |
194 // Hook to be called at the end of a pass. | 201 // Hook to be called at the end of a pass. |
195 virtual void EndPassHook() {} | 202 virtual void EndPassHook() {} |
196 | 203 |
197 // Hook to be called before encoding a frame. | 204 // Hook to be called before encoding a frame. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 238 } |
232 | 239 |
233 // Hook that can modify the encoder's output data | 240 // Hook that can modify the encoder's output data |
234 virtual const vpx_codec_cx_pkt_t *MutateEncoderOutputHook( | 241 virtual const vpx_codec_cx_pkt_t *MutateEncoderOutputHook( |
235 const vpx_codec_cx_pkt_t *pkt) { | 242 const vpx_codec_cx_pkt_t *pkt) { |
236 return pkt; | 243 return pkt; |
237 } | 244 } |
238 | 245 |
239 bool abort_; | 246 bool abort_; |
240 vpx_codec_enc_cfg_t cfg_; | 247 vpx_codec_enc_cfg_t cfg_; |
| 248 vpx_codec_dec_cfg_t dec_cfg_; |
241 unsigned int passes_; | 249 unsigned int passes_; |
242 unsigned long deadline_; | 250 unsigned long deadline_; |
243 TwopassStatsStore stats_; | 251 TwopassStatsStore stats_; |
244 unsigned long init_flags_; | 252 unsigned long init_flags_; |
245 unsigned long frame_flags_; | 253 unsigned long frame_flags_; |
246 vpx_codec_pts_t last_pts_; | 254 vpx_codec_pts_t last_pts_; |
247 }; | 255 }; |
248 | 256 |
249 } // namespace libvpx_test | 257 } // namespace libvpx_test |
250 | 258 |
251 #endif // TEST_ENCODE_TEST_DRIVER_H_ | 259 #endif // TEST_ENCODE_TEST_DRIVER_H_ |
OLD | NEW |