/* * Copyright (c) 2016, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/ #ifndef AOM_TEST_ENCODE_TEST_DRIVER_H_ #define AOM_TEST_ENCODE_TEST_DRIVER_H_
// 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(aom_codec_enc_cfg_t cfg, const aom_codec_flags_t init_flags,
TwopassStatsStore *stats)
: cfg_(cfg), init_flags_(init_flags), stats_(stats) {
memset(&encoder_, 0, sizeof(encoder_));
}
const aom_image_t *GetPreviewFrame() { return aom_codec_get_preview_frame(&encoder_);
} // This is a thin wrapper around aom_codec_encode(), so refer to // aom_encoder.h for its semantics. void EncodeFrame(VideoSource *video, aom_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),
mode_(kRealTime) { // Default to 1 thread.
cfg_.g_threads = 1;
}
virtual ~EncoderTest() = default;
// Initialize the cfg_ member with the default configuration for the // TestMode enum and maps the TestMode enum to the passes_ variable. void InitializeConfig(TestMode mode);
// Hook to be called on every decompressed frame. virtualvoid DecompressedFrameHook(const aom_image_t & /*img*/,
aom_codec_pts_t /*pts*/) {}
// Hook to be called to handle decode result. Return true to continue. virtualbool HandleDecodeResult(const aom_codec_err_t res_dec,
Decoder *decoder) {
EXPECT_EQ(AOM_CODEC_OK, res_dec) << decoder->DecodeError(); return AOM_CODEC_OK == res_dec;
}
virtualint GetNumSpatialLayers() { return 1; }
// Hook that can modify the encoder's output data virtualconst aom_codec_cx_pkt_t *MutateEncoderOutputHook( const aom_codec_cx_pkt_t *pkt) { return pkt;
}
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.