// Provides a simplified interface to manage one video encoding pass, given // a configuration and video source. // // TODO(jkoleszar): The exact services it provides and the appropriate // level of abstraction will be fleshed out as more tests are written. class Encoder { public:
Encoder(vpx_codec_enc_cfg_t cfg, vpx_enc_deadline_t deadline, constunsigned long init_flags, TwopassStatsStore *stats)
: cfg_(cfg), deadline_(deadline), init_flags_(init_flags), stats_(stats) {
memset(&encoder_, 0, sizeof(encoder_));
}
const vpx_image_t *GetPreviewFrame() { return vpx_codec_get_preview_frame(&encoder_);
} // This is a thin wrapper around vpx_codec_encode(), so refer to // vpx_encoder.h for its semantics. void EncodeFrame(VideoSource *video, vpx_enc_frame_flags_t frame_flags);
// Common test functionality for all Encoder tests. // // This class is a mixin which provides the main loop common to all // encoder tests. It provides hooks which can be overridden by subclasses // to implement each test's specific behavior, while centralizing the bulk // of the boilerplate. Note that it doesn't inherit the gtest testing // classes directly, so that tests can be parameterized differently. class EncoderTest { protected:
explicit EncoderTest(const CodecFactory *codec)
: codec_(codec), abort_(false), init_flags_(0), frame_flags_(0) { // Default to 1 thread.
cfg_.g_threads = 1;
}
virtual ~EncoderTest() {}
// Initialize the cfg_ member with the default configuration. void InitializeConfig();
// Map the TestMode enum to the deadline_ and passes_ variables. void SetMode(TestMode mode);
// Set encoder flag. void set_init_flags(unsigned long flag) { // NOLINT(runtime/int)
init_flags_ = flag;
}
// Main loop virtualvoid RunLoop(VideoSource *video);
// Hook to be called at the beginning of a pass. virtualvoid BeginPassHook(unsigned int /*pass*/) {}
// Hook to be called at the end of a pass. virtualvoid EndPassHook() {}
// Hook to be called before encoding a frame. virtualvoid PreEncodeFrameHook(VideoSource * /*video*/) {} virtualvoid PreEncodeFrameHook(VideoSource * /*video*/,
Encoder * /*encoder*/) {}
// Hook to be called on every decompressed frame. virtualvoid DecompressedFrameHook(const vpx_image_t & /*img*/,
vpx_codec_pts_t /*pts*/) {}
// Hook to be called to handle decode result. Return true to continue. virtualbool HandleDecodeResult(const vpx_codec_err_t res_dec, const VideoSource & /*video*/,
Decoder *decoder) {
EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError(); return VPX_CODEC_OK == res_dec;
}
// Hook that can modify the encoder's output data virtualconst vpx_codec_cx_pkt_t *MutateEncoderOutputHook( const vpx_codec_cx_pkt_t *pkt) { return pkt;
}
bool abort_;
vpx_codec_enc_cfg_t cfg_;
vpx_codec_dec_cfg_t dec_cfg_; unsigned int passes_;
vpx_enc_deadline_t deadline_;
TwopassStatsStore stats_; unsigned long init_flags_;
vpx_enc_frame_flags_t frame_flags_;
};
} // namespace libvpx_test
#endif// VPX_TEST_ENCODE_TEST_DRIVER_H_
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-08-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.