Fix levels with undefined rate Change-Id: I2ef24b041ee628ca328cb582590fcac3c957a6f8
diff --git a/av1/common/timing.c b/av1/common/timing.c index 3adb508..a959cdf 100644 --- a/av1/common/timing.c +++ b/av1/common/timing.c
@@ -15,22 +15,35 @@ * The tables are in Kbps instead of Mbps in the specification. * Note that depending on the profile, a multiplier is needed. */ +#define UNDEFINED_RATE \ + (1 << 21) // Placeholder rate for levels with undefined rate +#define INVALID_RATE \ + (0) // For invalid profile-level configuration, set rate to 0 /* Max Bitrates for levels of Main Tier in kbps. Bitrate in main_kbps [31] */ /* is a dummy value. The decoder model is not applicable for level 31. */ static int32_t main_kbps[1 << LEVEL_BITS] = { - 1500, 3000, 0, 0, 6000, 10000, 0, 0, 12000, 20000, 0, - 0, 30000, 40000, 60000, 60000, 60000, 100000, 160000, 160000, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, (1 << 26) + 1500, 3000, UNDEFINED_RATE, UNDEFINED_RATE, + 6000, 10000, UNDEFINED_RATE, UNDEFINED_RATE, + 12000, 20000, UNDEFINED_RATE, UNDEFINED_RATE, + 30000, 40000, 60000, 60000, + 60000, 100000, 160000, 160000, + UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE, + UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE, + UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE }; /* Max Bitrates for levels of High Tier in kbps. Bitrate in high_kbps [31] */ /* is a dummy value. The decoder model is not applicable for level 31. */ static int32_t high_kbps[1 << LEVEL_BITS] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 30000, 50000, 0, 0, 100000, 160000, 240000, 240000, - 240000, 480000, 800000, 800000, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, (1 << 26) + INVALID_RATE, INVALID_RATE, INVALID_RATE, INVALID_RATE, + INVALID_RATE, INVALID_RATE, INVALID_RATE, INVALID_RATE, + 30000, 50000, UNDEFINED_RATE, UNDEFINED_RATE, + 100000, 160000, 240000, 240000, + 240000, 480000, 800000, 800000, + UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE, + UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE, + UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE, UNDEFINED_RATE }; /* BitrateProfileFactor */
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index 48ee8be..a69c22d 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -1182,16 +1182,8 @@ } else if (does_level_match(oxcf->width, oxcf->height, oxcf->init_framerate, 8192, 4352, 120.0, 2)) { level = SEQ_LEVEL_6_2; - } else if (does_level_match(oxcf->width, oxcf->height, oxcf->init_framerate, - 16384, 8704, 30.0, 2)) { - level = SEQ_LEVEL_7_0; - } else if (does_level_match(oxcf->width, oxcf->height, oxcf->init_framerate, - 16384, 8704, 60.0, 2)) { - level = SEQ_LEVEL_7_1; - } else if (does_level_match(oxcf->width, oxcf->height, oxcf->init_framerate, - 16384, 8704, 120.0, 2)) { - level = SEQ_LEVEL_7_2; } + for (int i = 0; i < MAX_NUM_OPERATING_POINTS; ++i) { seq->seq_level_idx[i] = level; // Set the maximum parameters for bitrate and buffer size for this profile,