avcodec/h274: trim unnecessarily large array

We only ever read to idx+3, so 256 values are overkill.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Niklas Haas 2021-09-05 13:02:57 +02:00 committed by James Almer
parent 52c35d648c
commit a543d075cd

View File

@ -30,7 +30,7 @@
#include "h274.h" #include "h274.h"
static const int8_t Gaussian_LUT[2048+256]; static const int8_t Gaussian_LUT[2048+4];
static const uint32_t Seed_LUT[256]; static const uint32_t Seed_LUT[256];
static const int8_t R64T[64][64]; static const int8_t R64T[64][64];
@ -289,7 +289,7 @@ int ff_h274_apply_film_grain(AVFrame *out_frame, const AVFrame *in_frame,
} }
// These tables are all taken from the SMPTE RDD 5-2006 specification // These tables are all taken from the SMPTE RDD 5-2006 specification
static const int8_t Gaussian_LUT[2048+256] = { static const int8_t Gaussian_LUT[2048+4] = {
-11, 12, 103, -11, 42, -35, 12, 59, 77, 98, -87, 3, 65, -78, 45, 56, -51, 21, -11, 12, 103, -11, 42, -35, 12, 59, 77, 98, -87, 3, 65, -78, 45, 56, -51, 21,
13, -11, -20, -19, 33, -127, 17, -6, -105, 18, 19, 71, 48, -10, -38, 42, 13, -11, -20, -19, 33, -127, 17, -6, -105, 18, 19, 71, 48, -10, -38, 42,
-2, 75, -67, 52, -90, 33, -47, 21, -3, -56, 49, 1, -57, -42, -1, 120, -127, -2, 75, -67, 52, -90, 33, -47, 21, -3, -56, 49, 1, -57, -42, -1, 120, -127,
@ -417,22 +417,7 @@ static const int8_t Gaussian_LUT[2048+256] = {
4, -66, -81, 122, -20, -34, -37, -84, 127, 68, 46, 17, 47, 4, -66, -81, 122, -20, -34, -37, -84, 127, 68, 46, 17, 47,
// Repeat the beginning of the array to allow wrapping reads // Repeat the beginning of the array to allow wrapping reads
-11, 12, 103, -11, 42, -35, 12, 59, 77, 98, -87, 3, 65, -78, 45, 56, -51, 21, -11, 12, 103, -11,
13, -11, -20, -19, 33, -127, 17, -6, -105, 18, 19, 71, 48, -10, -38, 42,
-2, 75, -67, 52, -90, 33, -47, 21, -3, -56, 49, 1, -57, -42, -1, 120, -127,
-108, -49, 9, 14, 127, 122, 109, 52, 127, 2, 7, 114, 19, 30, 12, 77, 112,
82, -61, -127, 111, -52, -29, 2, -49, -24, 58, -29, -73, 12, 112, 67, 79,
-3, -114, -87, -6, -5, 40, 58, -81, 49, -27, -31, -34, -105, 50, 16, -24,
-35, -14, -15, -127, -55, -22, -55, -127, -112, 5, -26, -72, 127, 127, -2,
41, 87, -65, -16, 55, 19, 91, -81, -65, -64, 35, -7, -54, 99, -7, 88, 125,
-26, 91, 0, 63, 60, -14, -23, 113, -33, 116, 14, 26, 51, -16, 107, -8, 53,
38, -34, 17, -7, 4, -91, 6, 63, 63, -15, 39, -36, 19, 55, 17, -51, 40, 33,
-37, 126, -39, -118, 17, -30, 0, 19, 98, 60, 101, -12, -73, -17, -52, 98,
3, 3, 60, 33, -3, -2, 10, -42, -106, -38, 14, 127, 16, -127, -31, -86, -39,
-56, 46, -41, 75, 23, -19, -22, -70, 74, -54, -2, 32, -45, 17, -92, 59,
-64, -67, 56, -102, -29, -87, -34, -92, 68, 5, -74, -61, 93, -43, 14, -26,
-38, -126, -17, 16, -127, 64, 34, 31, 93, 17, -51, -59, 71, 77, 81, 127,
127, 61, 33, -106, -93, 0, 0, 75,
}; };
static const uint32_t Seed_LUT[256] = { static const uint32_t Seed_LUT[256] = {