aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-11 18:35:24 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-14 00:21:49 +0200
commit383fdec3b2568681c5ed905bcd6d3628308c8e4c (patch)
treee20db51295a02194d0ce2c73f938074b76e55ed2
parent79f6a1b96ee20eec311e8c44c2bcd5f8fb49f55f (diff)
downloadffmpeg-383fdec3b2568681c5ed905bcd6d3628308c8e4c.tar.gz
avcodec/cllc: Factor VLC_BITS/DEPTH out, do not use repeated literal numbers
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit e717fa1f0a66825fb10fec7debad768f311ee240) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/cllc.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c
index 80b049861e..bbd2e62c5c 100644
--- a/libavcodec/cllc.c
+++ b/libavcodec/cllc.c
@@ -29,6 +29,10 @@
#include "avcodec.h"
#include "internal.h"
+#define VLC_BITS 7
+#define VLC_DEPTH 2
+
+
typedef struct CLLCContext {
AVCodecContext *avctx;
BswapDSPContext bdsp;
@@ -74,7 +78,7 @@ static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
prefix <<= 1;
}
- return ff_init_vlc_sparse(vlc, 7, count, bits, 1, 1,
+ return ff_init_vlc_sparse(vlc, VLC_BITS, count, bits, 1, 1,
codes, 2, 2, symbols, 1, 1, 0);
}
@@ -101,7 +105,7 @@ static int read_argb_line(CLLCContext *ctx, GetBitContext *gb, int *top_left,
for (i = 0; i < ctx->avctx->width; i++) {
/* Always get the alpha component */
UPDATE_CACHE(bits, gb);
- GET_VLC(code, bits, gb, vlc[0].table, 7, 2);
+ GET_VLC(code, bits, gb, vlc[0].table, VLC_BITS, VLC_DEPTH);
pred[0] += code;
dst[0] = pred[0];
@@ -110,21 +114,21 @@ static int read_argb_line(CLLCContext *ctx, GetBitContext *gb, int *top_left,
if (dst[0]) {
/* Red */
UPDATE_CACHE(bits, gb);
- GET_VLC(code, bits, gb, vlc[1].table, 7, 2);
+ GET_VLC(code, bits, gb, vlc[1].table, VLC_BITS, VLC_DEPTH);
pred[1] += code;
dst[1] = pred[1];
/* Green */
UPDATE_CACHE(bits, gb);
- GET_VLC(code, bits, gb, vlc[2].table, 7, 2);
+ GET_VLC(code, bits, gb, vlc[2].table, VLC_BITS, VLC_DEPTH);
pred[2] += code;
dst[2] = pred[2];
/* Blue */
UPDATE_CACHE(bits, gb);
- GET_VLC(code, bits, gb, vlc[3].table, 7, 2);
+ GET_VLC(code, bits, gb, vlc[3].table, VLC_BITS, VLC_DEPTH);
pred[3] += code;
dst[3] = pred[3];
@@ -166,7 +170,7 @@ static int read_rgb24_component_line(CLLCContext *ctx, GetBitContext *gb,
/* Simultaneously read and restore the line */
for (i = 0; i < ctx->avctx->width; i++) {
UPDATE_CACHE(bits, gb);
- GET_VLC(code, bits, gb, vlc->table, 7, 2);
+ GET_VLC(code, bits, gb, vlc->table, VLC_BITS, VLC_DEPTH);
pred += code;
dst[0] = pred;
@@ -195,7 +199,7 @@ static int read_yuv_component_line(CLLCContext *ctx, GetBitContext *gb,
/* Simultaneously read and restore the line */
for (i = 0; i < ctx->avctx->width >> is_chroma; i++) {
UPDATE_CACHE(bits, gb);
- GET_VLC(code, bits, gb, vlc->table, 7, 2);
+ GET_VLC(code, bits, gb, vlc->table, VLC_BITS, VLC_DEPTH);
pred += code;
outbuf[i] = pred;