/* * Copyright (c) 2018, 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.
*/
// Lookup and remove and check that the entry is no longer there
EXPECT_TRUE(aom_film_grain_table_lookup(&table, 1000, 2000, true, &grain));
EXPECT_FALSE(aom_film_grain_table_lookup(&table, 1000, 2000, false, &grain));
// Test lookup and remove that adjusts start time
EXPECT_TRUE(aom_film_grain_table_lookup(&table, 0, 100, true, &grain));
EXPECT_EQ(nullptr, table.head->next);
EXPECT_EQ(100, table.head->start_time);
// Test lookup and remove that adjusts end time
EXPECT_TRUE(aom_film_grain_table_lookup(&table, 900, 1000, true, &grain));
EXPECT_EQ(nullptr, table.head->next);
EXPECT_EQ(100, table.head->start_time);
EXPECT_EQ(900, table.head->end_time);
// Test lookup and remove that splits the first entry
EXPECT_TRUE(aom_film_grain_table_lookup(&table, 400, 600, true, &grain));
EXPECT_EQ(100, table.head->start_time);
EXPECT_EQ(400, table.head->end_time);
aom_film_grain_t grain; constint kNumTestVectors = sizeof(film_grain_test_vectors) / sizeof(film_grain_test_vectors[0]); for (int i = 0; i < kNumTestVectors; ++i) {
aom_film_grain_table_append(&table, i * 1000, (i + 1) * 1000,
film_grain_test_vectors + i);
}
for (int i = kNumTestVectors - 1; i >= 0; --i) {
EXPECT_TRUE(aom_film_grain_table_lookup(&table, i * 1000, (i + 1) * 1000, true, &grain));
grain_equal(film_grain_test_vectors + i, &grain);
EXPECT_FALSE(aom_film_grain_table_lookup(&table, i * 1000, (i + 1) * 1000, true, &grain));
}
// Verify that all the data has been removed for (int i = 0; i < kNumTestVectors; ++i) {
EXPECT_FALSE(aom_film_grain_table_lookup(&table, i * 1000, (i + 1) * 1000, true, &grain));
}
aom_film_grain_table_free(&table);
}
class FilmGrainTableIOTest : public ::testing::Test { protected: void SetUp() override { memset(&error_, 0, sizeof(error_)); } struct aom_internal_error_info error_;
};
private: // 0: monochroome always off. // 1: monochrome always on. // 2: monochrome changes from 0, 1, 0, for encoded frames 0, 1, 2. // The case where monochrome changes from 1 to 0 (i.e., encoder initialized // with monochrome = 1 and then subsequently encoded with monochrome = 0) // will fail. The test InitMonochrome1_EncodeMonochrome0 below verifies this. int test_monochrome_; int key_frame_dist_;
::libaom_test::TestMode test_mode_;
};
// Initialize encoder with monochrome = 1, and then encode frame with // monochrome = 0. This will result in an error: see the following check // in encoder_set_config() in av1/av1_cx_iface.c. // TODO(marpan): Consider moving this test to another file, as the failure // has nothing to do with film grain mode.
TEST(FilmGrainEncodeTest, InitMonochrome1EncodeMonochrome0) { constint kWidth = 352; constint kHeight = 288; constint usage = AOM_USAGE_REALTIME;
aom_codec_iface_t *iface = aom_codec_av1_cx();
aom_codec_enc_cfg_t cfg;
ASSERT_EQ(aom_codec_enc_config_default(iface, &cfg, usage), AOM_CODEC_OK);
aom_codec_ctx_t enc;
cfg.g_w = kWidth;
cfg.g_h = kHeight; // Initialize encoder, with monochrome = 0.
cfg.monochrome = 1;
aom_codec_err_t init_status = aom_codec_enc_init(&enc, iface, &cfg, 0);
ASSERT_EQ(init_status, AOM_CODEC_OK);
ASSERT_EQ(aom_codec_control(&enc, AOME_SET_CPUUSED, 7), AOM_CODEC_OK);
ASSERT_EQ(aom_codec_control(&enc, AV1E_SET_TUNE_CONTENT, AOM_CONTENT_FILM),
AOM_CODEC_OK);
ASSERT_EQ(aom_codec_control(&enc, AV1E_SET_DENOISE_NOISE_LEVEL, 1),
AOM_CODEC_OK); // Set image with zero values.
constexpr size_t kBufferSize =
kWidth * kHeight + 2 * (kWidth + 1) / 2 * (kHeight + 1) / 2;
std::vector<unsignedchar> buffer(kBufferSize);
aom_image_t img;
EXPECT_EQ(&img, aom_img_wrap(&img, AOM_IMG_FMT_I420, kWidth, kHeight, 1,
buffer.data())); // Encode first frame.
ASSERT_EQ(aom_codec_encode(&enc, &img, 0, 1, 0), AOM_CODEC_OK); // Second frame: update config with monochrome = 1.
cfg.monochrome = 0;
ASSERT_EQ(aom_codec_enc_config_set(&enc, &cfg), AOM_CODEC_INVALID_PARAM);
ASSERT_EQ(aom_codec_destroy(&enc), AOM_CODEC_OK);
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.4Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-04-28)
¤
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.