mjpegenc: do not pass MpegEncContext to put_huffman_table()
authorAnton Khirnov <anton@khirnov.net>
Sun, 1 Dec 2013 20:35:02 +0000 (21:35 +0100)
committerAnton Khirnov <anton@khirnov.net>
Thu, 5 Dec 2013 12:33:40 +0000 (13:33 +0100)
It only needs PutBitContext from it, so pass that directly.

libavcodec/mjpegenc.c

index c92be63..d67afe2 100644 (file)
@@ -81,10 +81,9 @@ void ff_mjpeg_encode_close(MpegEncContext *s)
 }
 
 /* table_class: 0 = DC coef, 1 = AC coefs */
 }
 
 /* table_class: 0 = DC coef, 1 = AC coefs */
-static int put_huffman_table(MpegEncContext *s, int table_class, int table_id,
+static int put_huffman_table(PutBitContext *p, int table_class, int table_id,
                              const uint8_t *bits_table, const uint8_t *value_table)
 {
                              const uint8_t *bits_table, const uint8_t *value_table)
 {
-    PutBitContext *p = &s->pb;
     int n, i;
 
     put_bits(p, 4, table_class);
     int n, i;
 
     put_bits(p, 4, table_class);
@@ -136,14 +135,14 @@ static void jpeg_table_header(MpegEncContext *s)
     ptr = put_bits_ptr(p);
     put_bits(p, 16, 0); /* patched later */
     size = 2;
     ptr = put_bits_ptr(p);
     put_bits(p, 16, 0); /* patched later */
     size = 2;
-    size += put_huffman_table(s, 0, 0, avpriv_mjpeg_bits_dc_luminance,
+    size += put_huffman_table(p, 0, 0, avpriv_mjpeg_bits_dc_luminance,
                               avpriv_mjpeg_val_dc);
                               avpriv_mjpeg_val_dc);
-    size += put_huffman_table(s, 0, 1, avpriv_mjpeg_bits_dc_chrominance,
+    size += put_huffman_table(p, 0, 1, avpriv_mjpeg_bits_dc_chrominance,
                               avpriv_mjpeg_val_dc);
 
                               avpriv_mjpeg_val_dc);
 
-    size += put_huffman_table(s, 1, 0, avpriv_mjpeg_bits_ac_luminance,
+    size += put_huffman_table(p, 1, 0, avpriv_mjpeg_bits_ac_luminance,
                               avpriv_mjpeg_val_ac_luminance);
                               avpriv_mjpeg_val_ac_luminance);
-    size += put_huffman_table(s, 1, 1, avpriv_mjpeg_bits_ac_chrominance,
+    size += put_huffman_table(p, 1, 1, avpriv_mjpeg_bits_ac_chrominance,
                               avpriv_mjpeg_val_ac_chrominance);
     AV_WB16(ptr, size);
 }
                               avpriv_mjpeg_val_ac_chrominance);
     AV_WB16(ptr, size);
 }