| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // Initialize the cfg_ member with the default configuration. | 182 // Initialize the cfg_ member with the default configuration. |
| 183 void InitializeConfig(); | 183 void InitializeConfig(); |
| 184 | 184 |
| 185 // Map the TestMode enum to the deadline_ and passes_ variables. | 185 // Map the TestMode enum to the deadline_ and passes_ variables. |
| 186 void SetMode(TestMode mode); | 186 void SetMode(TestMode mode); |
| 187 | 187 |
| 188 // Main loop | 188 // Main loop |
| 189 virtual void RunLoop(VideoSource *video); | 189 virtual void RunLoop(VideoSource *video); |
| 190 | 190 |
| 191 // Hook to be called at the beginning of a pass. | 191 // Hook to be called at the beginning of a pass. |
| 192 virtual void BeginPassHook(unsigned int pass) {} | 192 virtual void BeginPassHook(unsigned int /*pass*/) {} |
| 193 | 193 |
| 194 // Hook to be called at the end of a pass. | 194 // Hook to be called at the end of a pass. |
| 195 virtual void EndPassHook() {} | 195 virtual void EndPassHook() {} |
| 196 | 196 |
| 197 // Hook to be called before encoding a frame. | 197 // Hook to be called before encoding a frame. |
| 198 virtual void PreEncodeFrameHook(VideoSource *video) {} | 198 virtual void PreEncodeFrameHook(VideoSource* /*video*/) {} |
| 199 virtual void PreEncodeFrameHook(VideoSource *video, Encoder *encoder) {} | 199 virtual void PreEncodeFrameHook(VideoSource* /*video*/, |
| 200 Encoder* /*encoder*/) {} |
| 200 | 201 |
| 201 // Hook to be called on every compressed data packet. | 202 // Hook to be called on every compressed data packet. |
| 202 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {} | 203 virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {} |
| 203 | 204 |
| 204 // Hook to be called on every PSNR packet. | 205 // Hook to be called on every PSNR packet. |
| 205 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {} | 206 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {} |
| 206 | 207 |
| 207 // Hook to determine whether the encode loop should continue. | 208 // Hook to determine whether the encode loop should continue. |
| 208 virtual bool Continue() const { | 209 virtual bool Continue() const { |
| 209 return !(::testing::Test::HasFatalFailure() || abort_); | 210 return !(::testing::Test::HasFatalFailure() || abort_); |
| 210 } | 211 } |
| 211 | 212 |
| 212 const CodecFactory *codec_; | 213 const CodecFactory *codec_; |
| 213 // Hook to determine whether to decode frame after encoding | 214 // Hook to determine whether to decode frame after encoding |
| 214 virtual bool DoDecode() const { return 1; } | 215 virtual bool DoDecode() const { return 1; } |
| 215 | 216 |
| 216 // Hook to handle encode/decode mismatch | 217 // Hook to handle encode/decode mismatch |
| 217 virtual void MismatchHook(const vpx_image_t *img1, | 218 virtual void MismatchHook(const vpx_image_t *img1, |
| 218 const vpx_image_t *img2); | 219 const vpx_image_t *img2); |
| 219 | 220 |
| 220 // Hook to be called on every decompressed frame. | 221 // Hook to be called on every decompressed frame. |
| 221 virtual void DecompressedFrameHook(const vpx_image_t& img, | 222 virtual void DecompressedFrameHook(const vpx_image_t& /*img*/, |
| 222 vpx_codec_pts_t pts) {} | 223 vpx_codec_pts_t /*pts*/) {} |
| 223 | 224 |
| 224 // Hook to be called to handle decode result. Return true to continue. | 225 // Hook to be called to handle decode result. Return true to continue. |
| 225 virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec, | 226 virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec, |
| 226 const VideoSource& /* video */, | 227 const VideoSource& /*video*/, |
| 227 Decoder *decoder) { | 228 Decoder *decoder) { |
| 228 EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError(); | 229 EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError(); |
| 229 return VPX_CODEC_OK == res_dec; | 230 return VPX_CODEC_OK == res_dec; |
| 230 } | 231 } |
| 231 | 232 |
| 232 // Hook that can modify the encoder's output data | 233 // Hook that can modify the encoder's output data |
| 233 virtual const vpx_codec_cx_pkt_t * MutateEncoderOutputHook( | 234 virtual const vpx_codec_cx_pkt_t *MutateEncoderOutputHook( |
| 234 const vpx_codec_cx_pkt_t *pkt) { | 235 const vpx_codec_cx_pkt_t *pkt) { |
| 235 return pkt; | 236 return pkt; |
| 236 } | 237 } |
| 237 | 238 |
| 238 bool abort_; | 239 bool abort_; |
| 239 vpx_codec_enc_cfg_t cfg_; | 240 vpx_codec_enc_cfg_t cfg_; |
| 240 unsigned int passes_; | 241 unsigned int passes_; |
| 241 unsigned long deadline_; | 242 unsigned long deadline_; |
| 242 TwopassStatsStore stats_; | 243 TwopassStatsStore stats_; |
| 243 unsigned long init_flags_; | 244 unsigned long init_flags_; |
| 244 unsigned long frame_flags_; | 245 unsigned long frame_flags_; |
| 245 vpx_codec_pts_t last_pts_; | 246 vpx_codec_pts_t last_pts_; |
| 246 }; | 247 }; |
| 247 | 248 |
| 248 } // namespace libvpx_test | 249 } // namespace libvpx_test |
| 249 | 250 |
| 250 #endif // TEST_ENCODE_TEST_DRIVER_H_ | 251 #endif // TEST_ENCODE_TEST_DRIVER_H_ |
| OLD | NEW |