diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-01 17:45:33 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-01 17:52:18 +0200 |
commit | 2514b80045d56411343df80f07276817b5f0d1b0 (patch) | |
tree | 0513197dfd36cbd10ade427918c91ba9237d5373 /libswscale/utils.c | |
parent | 4818388e6c219bf48fa93bf76ee6ab3dc3fb1e8f (diff) | |
download | ffmpeg-2514b80045d56411343df80f07276817b5f0d1b0.tar.gz |
sws: share xyzgamma tables.
They are currently always constant and thus theres no point to
store them in the context.
This makes the context 16kb smaller
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r-- | libswscale/utils.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index f13fec8977..f0139401fc 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -904,13 +904,20 @@ static void fill_xyztables(struct SwsContext *c) {13270, -6295, -2041}, {-3969, 7682, 170}, { 228, -835, 4329} }; + static int16_t xyzgamma_tab[4096], rgbgamma_tab[4096]; + + memcpy(c->xyz2rgb_matrix, xyz2rgb_matrix, sizeof(c->xyz2rgb_matrix)); + c->xyzgamma = xyzgamma_tab; + c->rgbgamma = rgbgamma_tab; + + if (rgbgamma_tab[4095]) + return; /* set gamma vectors */ for (i = 0; i < 4096; i++) { - c->xyzgamma[i] = lrint(pow(i / 4095.0, xyzgamma) * 4095.0); - c->rgbgamma[i] = lrint(pow(i / 4095.0, rgbgamma) * 4095.0); + xyzgamma_tab[i] = lrint(pow(i / 4095.0, xyzgamma) * 4095.0); + rgbgamma_tab[i] = lrint(pow(i / 4095.0, rgbgamma) * 4095.0); } - memcpy(c->xyz2rgb_matrix, xyz2rgb_matrix, sizeof(c->xyz2rgb_matrix)); } int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], |