OpenVisualCloud / SVT-HEVC

SVT HEVC encoder. Scalable Video Technology (SVT) is a software-based video coding technology that is highly optimized for Intel® Xeon® processors. Using the open source SVT-HEVC encoder, it is possible to spread video encoding processing across multiple Intel® Xeon® processors to achieve a real advantage of processing efficiency.
Other
519 stars 169 forks source link

Fix reading overflow when estimating bits for SAO offset values in 10bit #407

Closed luofalei closed 4 years ago

luofalei commented 5 years ago

In 10bit coding, the offset value can be larger than 7. The range is defined as follows in file EbSampleAdaptiveOffsetGenerationDecisioin.c.

static EB_S32 MinSaoOffsetvalueEO[2 /*8bit+10bit*/][SAO_EO_CATEGORIES] = { {0, 0, -7, -7},{0,  0, -31, -31} };
static EB_S32 MaxSaoOffsetvalueEO[2 /*8bit+10bit*/][SAO_EO_CATEGORIES] = { {7, 7,  0,  0},{31, 31, 0,    0} };
static EB_S32 MaxSaoOffsetvalueBO[2 /*8bit+10bit*/] = { 7 , 31 };
static EB_S32 MinSaoOffsetvalueBO[2 /*8bit+10bit*/] = { -7 ,-31 };

When the offset value is larger than the array size of saoOffsetTrunUnaryBits, reading overflow would happen.

This commit forces a maxminum value of 7.