diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2022-08-10 01:00:56 +0200 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2022-08-19 22:09:36 +0200 |
commit | f3fb528cd5bfecec6835a3951c75903a194ae1ad (patch) | |
tree | a2d67c75082a009f1c299dfb319fd54a9357e4a4 /libavcodec/exrenc.c | |
parent | cb8ad005bb73b1adf0d36eeb794c4c375fd3ee12 (diff) | |
download | ffmpeg-f3fb528cd5bfecec6835a3951c75903a194ae1ad.tar.gz |
avutil/half2float: move tables to header-internal structs
Having to put the knowledge of the size of those arrays into a multitude
of places is rather smelly.
Diffstat (limited to 'libavcodec/exrenc.c')
-rw-r--r-- | libavcodec/exrenc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c index 56c084d483..356bd11543 100644 --- a/libavcodec/exrenc.c +++ b/libavcodec/exrenc.c @@ -87,15 +87,14 @@ typedef struct EXRContext { EXRScanlineData *scanline; - uint16_t basetable[512]; - uint8_t shifttable[512]; + Float2HalfTables f2h_tables; } EXRContext; static av_cold int encode_init(AVCodecContext *avctx) { EXRContext *s = avctx->priv_data; - float2half_tables(s->basetable, s->shifttable); + init_float2half_tables(&s->f2h_tables); switch (avctx->pix_fmt) { case AV_PIX_FMT_GBRPF32: @@ -256,7 +255,7 @@ static int encode_scanline_rle(EXRContext *s, const AVFrame *frame) const uint32_t *src = (const uint32_t *)(frame->data[ch] + y * frame->linesize[ch]); for (int x = 0; x < frame->width; x++) - dst[x] = float2half(src[x], s->basetable, s->shifttable); + dst[x] = float2half(src[x], &s->f2h_tables); } break; } @@ -324,7 +323,7 @@ static int encode_scanline_zip(EXRContext *s, const AVFrame *frame) const uint32_t *src = (const uint32_t *)(frame->data[ch] + (y * s->scanline_height + l) * frame->linesize[ch]); for (int x = 0; x < frame->width; x++) - dst[x] = float2half(src[x], s->basetable, s->shifttable); + dst[x] = float2half(src[x], &s->f2h_tables); } } break; @@ -482,7 +481,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const uint32_t *src = (const uint32_t *)(frame->data[ch] + y * frame->linesize[ch]); for (int x = 0; x < frame->width; x++) - bytestream2_put_le16(pb, float2half(src[x], s->basetable, s->shifttable)); + bytestream2_put_le16(pb, float2half(src[x], &s->f2h_tables)); } } } |