// Test for encoding frames with dimensions > 32768 pixels. // // pickcdef.c used FULLPEL_MV (int16_t row/col) to store pixel positions in // get_filt_error(). For frames taller than 32768 pixels, the pixel row // overflows int16_t, wrapping to a negative value and causing an out-of-bounds // read. aom_codec_encode() should not crash or read out of bounds. See bug // 489473886.
// Encode a single frame with the given dimensions and flush. void EncodeSingleFrame(unsignedint width, unsignedint height, unsignedint usage, int cpu_used) {
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);
cfg.g_w = width;
cfg.g_h = height;
cfg.g_lag_in_frames = 0;
cfg.g_pass = AOM_RC_ONE_PASS; // Use VBR with moderate QP to ensure non-skip blocks, which is necessary // to exercise the CDEF search path. AOM_Q with low cq_level triggers an // early return in adaptive CDEF for ALL_INTRA mode.
cfg.rc_end_usage = AOM_VBR;
cfg.rc_target_bitrate = 1000;
class EncodeBigDimension
: public testing::TestWithParam<unsignedint/*usage*/> {};
// Height > 32768: triggers the CDEF int16_t overflow at superblock row 512. // 32832 = 513 * 64, giving 513 superblock rows (fbr 0..512). // Use ALL_INTRA at speed 6 so the full CDEF search runs (not CDEF_PICK_FROM_Q) // while keeping encode time reasonable.
TEST_P(EncodeBigDimension, TallFrame) {
EncodeSingleFrame(/*width=*/64, /*height=*/32832, /*usage=*/GetParam(), /*cpu_used=*/5);
}
// Width > 32768: same int16_t overflow but in the column direction.
TEST_P(EncodeBigDimension, WideFrame) {
EncodeSingleFrame(/*width=*/32832, /*height=*/64, /*usage=*/GetParam(), /*cpu_used=*/5);
}
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.