]> git.sesse.net Git - ffmpeg/commitdiff
mjpegenc: do not pass MpegEncContext to ff_mjpeg_encode_picture_trailer()
authorAnton Khirnov <anton@khirnov.net>
Sun, 1 Dec 2013 21:05:18 +0000 (22:05 +0100)
committerAnton Khirnov <anton@khirnov.net>
Thu, 5 Dec 2013 12:35:15 +0000 (13:35 +0100)
This will allow deMpegEncContextizing the LJPEG encoder.

libavcodec/ljpegenc.c
libavcodec/mjpegenc.c
libavcodec/mjpegenc.h
libavcodec/mpegvideo_enc.c

index d94cfbfa885d0d485e0f003ff44d560582fe65ff..46b51ab48d2684f8c199860dc150ca160a33a0a3 100644 (file)
@@ -193,7 +193,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
 
     emms_c();
 
-    ff_mjpeg_encode_picture_trailer(s);
+    ff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits);
     s->picture_number++;
 
     flush_put_bits(&s->pb);
index 1d69e671d51ca1d1a3b5606ac599578653027f34..f5c70f9c3c12ecd725559827d778f6a491eee79e 100644 (file)
@@ -269,11 +269,11 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
     put_bits(pb, 8, 0); /* Ah/Al (not used) */
 }
 
-static void escape_FF(MpegEncContext *s, int start)
+static void escape_FF(PutBitContext *pb, int start)
 {
-    int size= put_bits_count(&s->pb) - start*8;
+    int size = put_bits_count(pb) - start * 8;
     int i, ff_count;
-    uint8_t *buf= s->pb.buf + start;
+    uint8_t *buf = pb->buf + start;
     int align= (-(size_t)(buf))&3;
 
     assert((size&7) == 0);
@@ -306,8 +306,8 @@ static void escape_FF(MpegEncContext *s, int start)
 
     if(ff_count==0) return;
 
-    flush_put_bits(&s->pb);
-    skip_put_bytes(&s->pb, ff_count);
+    flush_put_bits(pb);
+    skip_put_bytes(pb, ff_count);
 
     for(i=size-1; ff_count; i--){
         int v= buf[i];
@@ -328,16 +328,16 @@ void ff_mjpeg_encode_stuffing(PutBitContext * pbc)
     if(length) put_bits(pbc, length, (1<<length)-1);
 }
 
-void ff_mjpeg_encode_picture_trailer(MpegEncContext *s)
+void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits)
 {
-    ff_mjpeg_encode_stuffing(&s->pb);
-    flush_put_bits(&s->pb);
+    ff_mjpeg_encode_stuffing(pb);
+    flush_put_bits(pb);
 
-    assert((s->header_bits&7)==0);
+    assert((header_bits & 7) == 0);
 
-    escape_FF(s, s->header_bits>>3);
+    escape_FF(pb, header_bits >> 3);
 
-    put_marker(&s->pb, EOI);
+    put_marker(pb, EOI);
 }
 
 void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
index 62085cd2eb3b5e7258745eac288cf199287f2da8..81dd7475e9aaa0e968ec4cfb449133fb76b449f5 100644 (file)
@@ -54,7 +54,7 @@ void ff_mjpeg_encode_close(MpegEncContext *s);
 void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
                                     ScanTable *intra_scantable,
                                     uint16_t intra_matrix[64]);
-void ff_mjpeg_encode_picture_trailer(MpegEncContext *s);
+void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits);
 void ff_mjpeg_encode_stuffing(PutBitContext *pbc);
 void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
                         uint8_t *huff_size, uint16_t *huff_code);
index f00eb2972194d73d795955b0be60def88dacf7c7..4fbe10e152f46f7bae1d23185f7d4cfbf0c9b28c 100644 (file)
@@ -1474,7 +1474,7 @@ vbv_retry:
         frame_end(s);
 
         if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG)
-            ff_mjpeg_encode_picture_trailer(s);
+            ff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits);
 
         if (avctx->rc_buffer_size) {
             RateControlContext *rcc = &s->rc_context;