Port renaming changes from AOMedia
Cherry-Picked the following commits: 0defd8f Changed "WebM" to "AOMedia" & "webm" to "aomedia" 54e6676 Replace "VPx" by "AVx" 5082a36 Change "Vpx" to "Avx" 7df44f1 Replace "Vp9" w/ "Av1" 967f722 Remove kVp9CodecId 828f30c Change "Vp8" to "AOM" 030b5ff AUTHORS regenerated 2524cae Add ref-mv experimental flag 016762b Change copyright notice to AOMedia form 81e5526 Replace vp9 w/ av1 9b94565 Add missing files fa8ca9f Change "vp9" to "av1" ec838b7 Convert "vp8" to "aom" 80edfa0 Change "VP9" to "AV1" d1a11fb Change "vp8" to "aom" 7b58251 Point to WebM test data dd1a5c8 Replace "VP8" with "AOM" ff00fc0 Change "VPX" to "AOM" 01dee0b Change "vp10" to "av1" in source code cebe6f0 Convert "vpx" to "aom" 17b0567 rename vp10*.mk to av1_*.mk fe5f8a8 rename files vp10_* to av1_* Change-Id: I6fc3d18eb11fc171e46140c836ad5339cf6c9419
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./aom_config.h"
|
||||
#include "aom_ports/mem.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
namespace libaom_test {
|
||||
void Encoder::InitEncoder(VideoSource *video) {
|
||||
vpx_codec_err_t res;
|
||||
const vpx_image_t *img = video->img();
|
||||
aom_codec_err_t res;
|
||||
const aom_image_t *img = video->img();
|
||||
|
||||
if (video->img() && !encoder_.priv) {
|
||||
cfg_.g_w = img->d_w;
|
||||
@@ -31,18 +31,18 @@ void Encoder::InitEncoder(VideoSource *video) {
|
||||
cfg_.g_timebase = video->timebase();
|
||||
cfg_.rc_twopass_stats_in = stats_->buf();
|
||||
|
||||
res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_, init_flags_);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
res = aom_codec_enc_init(&encoder_, CodecInterface(), &cfg_, init_flags_);
|
||||
ASSERT_EQ(AOM_CODEC_OK, res) << EncoderError();
|
||||
|
||||
#if CONFIG_VP10_ENCODER
|
||||
if (CodecInterface() == &vpx_codec_vp10_cx_algo) {
|
||||
// Default to 1 tile column for VP10. With CONFIG_EXT_TILE, the
|
||||
#if CONFIG_AV1_ENCODER
|
||||
if (CodecInterface() == &aom_codec_av1_cx_algo) {
|
||||
// Default to 1 tile column for AV1. With CONFIG_EXT_TILE, the
|
||||
// default is already the largest possible tile size
|
||||
#if !CONFIG_EXT_TILE
|
||||
const int log2_tile_columns = 0;
|
||||
res = vpx_codec_control_(&encoder_, VP9E_SET_TILE_COLUMNS,
|
||||
res = aom_codec_control_(&encoder_, AV1E_SET_TILE_COLUMNS,
|
||||
log2_tile_columns);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
ASSERT_EQ(AOM_CODEC_OK, res) << EncoderError();
|
||||
#endif // !CONFIG_EXT_TILE
|
||||
} else
|
||||
#endif
|
||||
@@ -60,8 +60,8 @@ void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
|
||||
// Handle twopass stats
|
||||
CxDataIterator iter = GetCxData();
|
||||
|
||||
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
|
||||
if (pkt->kind != VPX_CODEC_STATS_PKT) continue;
|
||||
while (const aom_codec_cx_pkt_t *pkt = iter.Next()) {
|
||||
if (pkt->kind != AOM_CODEC_STATS_PKT) continue;
|
||||
|
||||
stats_->Append(*pkt);
|
||||
}
|
||||
@@ -69,48 +69,48 @@ void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
|
||||
|
||||
void Encoder::EncodeFrameInternal(const VideoSource &video,
|
||||
const unsigned long frame_flags) {
|
||||
vpx_codec_err_t res;
|
||||
const vpx_image_t *img = video.img();
|
||||
aom_codec_err_t res;
|
||||
const aom_image_t *img = video.img();
|
||||
|
||||
// Handle frame resizing
|
||||
if (cfg_.g_w != img->d_w || cfg_.g_h != img->d_h) {
|
||||
cfg_.g_w = img->d_w;
|
||||
cfg_.g_h = img->d_h;
|
||||
res = vpx_codec_enc_config_set(&encoder_, &cfg_);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
res = aom_codec_enc_config_set(&encoder_, &cfg_);
|
||||
ASSERT_EQ(AOM_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
// Encode the frame
|
||||
API_REGISTER_STATE_CHECK(res = vpx_codec_encode(&encoder_, img, video.pts(),
|
||||
API_REGISTER_STATE_CHECK(res = aom_codec_encode(&encoder_, img, video.pts(),
|
||||
video.duration(), frame_flags,
|
||||
deadline_));
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
ASSERT_EQ(AOM_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
void Encoder::Flush() {
|
||||
const vpx_codec_err_t res =
|
||||
vpx_codec_encode(&encoder_, NULL, 0, 0, 0, deadline_);
|
||||
const aom_codec_err_t res =
|
||||
aom_codec_encode(&encoder_, NULL, 0, 0, 0, deadline_);
|
||||
if (!encoder_.priv)
|
||||
ASSERT_EQ(VPX_CODEC_ERROR, res) << EncoderError();
|
||||
ASSERT_EQ(AOM_CODEC_ERROR, res) << EncoderError();
|
||||
else
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
ASSERT_EQ(AOM_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
void EncoderTest::InitializeConfig() {
|
||||
const vpx_codec_err_t res = codec_->DefaultEncoderConfig(&cfg_, 0);
|
||||
dec_cfg_ = vpx_codec_dec_cfg_t();
|
||||
ASSERT_EQ(VPX_CODEC_OK, res);
|
||||
const aom_codec_err_t res = codec_->DefaultEncoderConfig(&cfg_, 0);
|
||||
dec_cfg_ = aom_codec_dec_cfg_t();
|
||||
ASSERT_EQ(AOM_CODEC_OK, res);
|
||||
}
|
||||
|
||||
void EncoderTest::SetMode(TestMode mode) {
|
||||
switch (mode) {
|
||||
case kRealTime: deadline_ = VPX_DL_REALTIME; break;
|
||||
case kRealTime: deadline_ = AOM_DL_REALTIME; break;
|
||||
|
||||
case kOnePassGood:
|
||||
case kTwoPassGood: deadline_ = VPX_DL_GOOD_QUALITY; break;
|
||||
case kTwoPassGood: deadline_ = AOM_DL_GOOD_QUALITY; break;
|
||||
|
||||
case kOnePassBest:
|
||||
case kTwoPassBest: deadline_ = VPX_DL_BEST_QUALITY; break;
|
||||
case kTwoPassBest: deadline_ = AOM_DL_BEST_QUALITY; break;
|
||||
|
||||
default: ASSERT_TRUE(false) << "Unexpected mode " << mode;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ static bool compare_plane(const uint8_t *const buf1, const int stride1,
|
||||
|
||||
// The function should return "true" most of the time, therefore no early
|
||||
// break-out is implemented within the match checking process.
|
||||
static bool compare_img(const vpx_image_t *img1, const vpx_image_t *img2,
|
||||
static bool compare_img(const aom_image_t *img1, const aom_image_t *img2,
|
||||
int *const mismatch_row, int *const mismatch_col,
|
||||
int *const mismatch_plane, int *const mismatch_pix1,
|
||||
int *const mismatch_pix2) {
|
||||
@@ -164,35 +164,35 @@ static bool compare_img(const vpx_image_t *img1, const vpx_image_t *img2,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!compare_plane(img1->planes[VPX_PLANE_Y], img1->stride[VPX_PLANE_Y],
|
||||
img2->planes[VPX_PLANE_Y], img2->stride[VPX_PLANE_Y], w_y,
|
||||
if (!compare_plane(img1->planes[AOM_PLANE_Y], img1->stride[AOM_PLANE_Y],
|
||||
img2->planes[AOM_PLANE_Y], img2->stride[AOM_PLANE_Y], w_y,
|
||||
h_y, mismatch_row, mismatch_col, mismatch_pix1,
|
||||
mismatch_pix2)) {
|
||||
if (mismatch_plane != NULL) *mismatch_plane = VPX_PLANE_Y;
|
||||
if (mismatch_plane != NULL) *mismatch_plane = AOM_PLANE_Y;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!compare_plane(img1->planes[VPX_PLANE_U], img1->stride[VPX_PLANE_U],
|
||||
img2->planes[VPX_PLANE_U], img2->stride[VPX_PLANE_U], w_uv,
|
||||
if (!compare_plane(img1->planes[AOM_PLANE_U], img1->stride[AOM_PLANE_U],
|
||||
img2->planes[AOM_PLANE_U], img2->stride[AOM_PLANE_U], w_uv,
|
||||
h_uv, mismatch_row, mismatch_col, mismatch_pix1,
|
||||
mismatch_pix2)) {
|
||||
if (mismatch_plane != NULL) *mismatch_plane = VPX_PLANE_U;
|
||||
if (mismatch_plane != NULL) *mismatch_plane = AOM_PLANE_U;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!compare_plane(img1->planes[VPX_PLANE_V], img1->stride[VPX_PLANE_V],
|
||||
img2->planes[VPX_PLANE_V], img2->stride[VPX_PLANE_V], w_uv,
|
||||
if (!compare_plane(img1->planes[AOM_PLANE_V], img1->stride[AOM_PLANE_V],
|
||||
img2->planes[AOM_PLANE_V], img2->stride[AOM_PLANE_V], w_uv,
|
||||
h_uv, mismatch_row, mismatch_col, mismatch_pix1,
|
||||
mismatch_pix2)) {
|
||||
if (mismatch_plane != NULL) *mismatch_plane = VPX_PLANE_U;
|
||||
if (mismatch_plane != NULL) *mismatch_plane = AOM_PLANE_U;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EncoderTest::MismatchHook(const vpx_image_t *img_enc,
|
||||
const vpx_image_t *img_dec) {
|
||||
void EncoderTest::MismatchHook(const aom_image_t *img_enc,
|
||||
const aom_image_t *img_dec) {
|
||||
int mismatch_row = 0;
|
||||
int mismatch_col = 0;
|
||||
int mismatch_plane = 0;
|
||||
@@ -212,7 +212,7 @@ void EncoderTest::MismatchHook(const vpx_image_t *img_enc,
|
||||
}
|
||||
|
||||
void EncoderTest::RunLoop(VideoSource *video) {
|
||||
vpx_codec_dec_cfg_t dec_cfg = vpx_codec_dec_cfg_t();
|
||||
aom_codec_dec_cfg_t dec_cfg = aom_codec_dec_cfg_t();
|
||||
|
||||
stats_.Reset();
|
||||
|
||||
@@ -221,11 +221,11 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
last_pts_ = 0;
|
||||
|
||||
if (passes_ == 1)
|
||||
cfg_.g_pass = VPX_RC_ONE_PASS;
|
||||
cfg_.g_pass = AOM_RC_ONE_PASS;
|
||||
else if (pass == 0)
|
||||
cfg_.g_pass = VPX_RC_FIRST_PASS;
|
||||
cfg_.g_pass = AOM_RC_FIRST_PASS;
|
||||
else
|
||||
cfg_.g_pass = VPX_RC_LAST_PASS;
|
||||
cfg_.g_pass = AOM_RC_LAST_PASS;
|
||||
|
||||
BeginPassHook(pass);
|
||||
testing::internal::scoped_ptr<Encoder> encoder(
|
||||
@@ -239,16 +239,16 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
unsigned long dec_init_flags = 0; // NOLINT
|
||||
// Use fragment decoder if encoder outputs partitions.
|
||||
// NOTE: fragment decoder and partition encoder are only supported by VP8.
|
||||
if (init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION)
|
||||
dec_init_flags |= VPX_CODEC_USE_INPUT_FRAGMENTS;
|
||||
if (init_flags_ & AOM_CODEC_USE_OUTPUT_PARTITION)
|
||||
dec_init_flags |= AOM_CODEC_USE_INPUT_FRAGMENTS;
|
||||
testing::internal::scoped_ptr<Decoder> decoder(
|
||||
codec_->CreateDecoder(dec_cfg, dec_init_flags, 0));
|
||||
#if CONFIG_VP10 && CONFIG_EXT_TILE
|
||||
if (decoder->IsVP10()) {
|
||||
#if CONFIG_AV1 && CONFIG_EXT_TILE
|
||||
if (decoder->IsAV1()) {
|
||||
// Set dec_cfg.tile_row = -1 and dec_cfg.tile_col = -1 so that the whole
|
||||
// frame is decoded.
|
||||
decoder->Control(VP10_SET_DECODE_TILE_ROW, -1);
|
||||
decoder->Control(VP10_SET_DECODE_TILE_COL, -1);
|
||||
decoder->Control(AV1_SET_DECODE_TILE_ROW, -1);
|
||||
decoder->Control(AV1_SET_DECODE_TILE_COL, -1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -264,14 +264,14 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
|
||||
bool has_cxdata = false;
|
||||
bool has_dxdata = false;
|
||||
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
|
||||
while (const aom_codec_cx_pkt_t *pkt = iter.Next()) {
|
||||
pkt = MutateEncoderOutputHook(pkt);
|
||||
again = true;
|
||||
switch (pkt->kind) {
|
||||
case VPX_CODEC_CX_FRAME_PKT:
|
||||
case AOM_CODEC_CX_FRAME_PKT:
|
||||
has_cxdata = true;
|
||||
if (decoder.get() != NULL && DoDecode()) {
|
||||
vpx_codec_err_t res_dec = decoder->DecodeFrame(
|
||||
aom_codec_err_t res_dec = decoder->DecodeFrame(
|
||||
(const uint8_t *)pkt->data.frame.buf, pkt->data.frame.sz);
|
||||
|
||||
if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
|
||||
@@ -283,22 +283,22 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
FramePktHook(pkt);
|
||||
break;
|
||||
|
||||
case VPX_CODEC_PSNR_PKT: PSNRPktHook(pkt); break;
|
||||
case AOM_CODEC_PSNR_PKT: PSNRPktHook(pkt); break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
// Flush the decoder when there are no more fragments.
|
||||
if ((init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) {
|
||||
const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
|
||||
if ((init_flags_ & AOM_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) {
|
||||
const aom_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
|
||||
if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
|
||||
}
|
||||
|
||||
if (has_dxdata && has_cxdata) {
|
||||
const vpx_image_t *img_enc = encoder->GetPreviewFrame();
|
||||
const aom_image_t *img_enc = encoder->GetPreviewFrame();
|
||||
DxDataIterator dec_iter = decoder->GetDxData();
|
||||
const vpx_image_t *img_dec = dec_iter.Next();
|
||||
const aom_image_t *img_dec = dec_iter.Next();
|
||||
if (img_enc && img_dec) {
|
||||
const bool res =
|
||||
compare_img(img_enc, img_dec, NULL, NULL, NULL, NULL, NULL);
|
||||
|
Reference in New Issue
Block a user