[libav-commits] mjpegenc: do not pass MpegEncContext to jpeg_table_header()

Anton Khirnov git at libav.org
Thu Dec 5 13:45:52 CET 2013


Module: libav
Branch: master
Commit: 6d70639c7d5fe762c5f18de574eafa817fb53ef7

Author:    Anton Khirnov <anton at khirnov.net>
Committer: Anton Khirnov <anton at khirnov.net>
Date:      Sun Dec  1 21:45:40 2013 +0100

mjpegenc: do not pass MpegEncContext to jpeg_table_header()

Pass the three needed fields from it directly.
This will allow to deMpegEncContextize the LJPEG encoder.

---

 libavcodec/mjpegenc.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 0322f8b..7b54e50 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -96,9 +96,9 @@ static int put_huffman_table(PutBitContext *p, int table_class, int table_id,
     return n + 17;
 }
 
-static void jpeg_table_header(MpegEncContext *s)
+static void jpeg_table_header(PutBitContext *p, ScanTable *intra_scantable,
+                              uint16_t intra_matrix[64])
 {
-    PutBitContext *p = &s->pb;
     int i, j, size;
     uint8_t *ptr;
 
@@ -108,8 +108,8 @@ static void jpeg_table_header(MpegEncContext *s)
     put_bits(p, 4, 0); /* 8 bit precision */
     put_bits(p, 4, 0); /* table 0 */
     for(i=0;i<64;i++) {
-        j = s->intra_scantable.permutated[i];
-        put_bits(p, 8, s->intra_matrix[j]);
+        j = intra_scantable->permutated[i];
+        put_bits(p, 8, intra_matrix[j]);
     }
 
     /* huffman table */
@@ -180,7 +180,7 @@ void ff_mjpeg_encode_picture_header(MpegEncContext *s)
 
     jpeg_put_comments(s->avctx, &s->pb);
 
-    jpeg_table_header(s);
+    jpeg_table_header(&s->pb, &s->intra_scantable, s->intra_matrix);
 
     switch(s->avctx->codec_id){
     case AV_CODEC_ID_MJPEG:  put_marker(&s->pb, SOF0 ); break;



More information about the libav-commits mailing list