[FFmpeg-devel] [PATCH 1/3] avcodec/huffyuv: add a field that represents the number of symbols

Michael Niedermayer michaelni at gmx.at
Mon Jan 13 01:22:13 CET 2014


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/huffyuv.h    |    1 +
 libavcodec/huffyuvdec.c |    2 ++
 libavcodec/huffyuvenc.c |    1 +
 3 files changed, 4 insertions(+)

diff --git a/libavcodec/huffyuv.h b/libavcodec/huffyuv.h
index b75cc89..0bd9f91 100644
--- a/libavcodec/huffyuv.h
+++ b/libavcodec/huffyuv.h
@@ -68,6 +68,7 @@ typedef struct HYuvContext {
     int yuy2;                               //use yuy2 instead of 422P
     int bgr32;                              //use bgr32 instead of bgr24
     int bps;
+    int n;
     int alpha;
     int chroma;
     int yuv;
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 611757d..15fce93 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -278,6 +278,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
         s->version = 0;
 
     s->bps = 8;
+    s->n = 1<<s->bps;
     s->chroma = 1;
     if (s->version >= 2) {
         int method, interlace;
@@ -294,6 +295,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
                 s->bitstream_bpp = avctx->bits_per_coded_sample & ~7;
         } else {
             s->bps = (avctx->extradata[1] >> 4) + 1;
+            s->n = 1<<s->bps;
             s->chroma_h_shift = avctx->extradata[1] & 3;
             s->chroma_v_shift = (avctx->extradata[1] >> 2) & 3;
             s->yuv   = !!(((uint8_t*)avctx->extradata)[2] & 1);
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 0ab61b2..5224480 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -228,6 +228,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "format not supported\n");
         return AVERROR(EINVAL);
     }
+    s->n = 1<<s->bps;
 
     avctx->bits_per_coded_sample = s->bitstream_bpp;
     s->decorrelate = s->bitstream_bpp >= 24 && !s->yuv && avctx->pix_fmt != AV_PIX_FMT_GBRP;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list