]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/jpegtables: Move ff_mjpeg_build_huffman_codes to mjpegenc_common
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 9 Feb 2021 23:31:46 +0000 (00:31 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 23 Feb 2021 09:14:25 +0000 (10:14 +0100)
Since g2meet.c doesn't use it any more, only encoders use it and
the place for their common code is mjpegenc_common.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/jpegtables.c
libavcodec/jpegtables.h
libavcodec/mjpegenc_common.c
libavcodec/mjpegenc_common.h

index e44bc7a22ad93ad94c7cc4e85e642dbd04541f34..ef3f8dee204e5f841b08357bb3e30cd690686b94 100644 (file)
@@ -122,24 +122,3 @@ const uint8_t avpriv_mjpeg_val_ac_chrominance[] =
   0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
   0xf9, 0xfa
 };
-
-/* isn't this function nicer than the one in the libjpeg ? */
-void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
-                                  const uint8_t *bits_table,
-                                  const uint8_t *val_table)
-{
-    int i, j, k,nb, code, sym;
-
-    k = 0;
-    code = 0;
-    for(i=1;i<=16;i++) {
-        nb = bits_table[i];
-        for(j=0;j<nb;j++) {
-            sym = val_table[k++];
-            huff_size[sym] = i;
-            huff_code[sym] = code;
-            code++;
-        }
-        code <<= 1;
-    }
-}
index aa38df40335f694c57760fd9cd2bc01af00a69db..090728044543760f1acf61e915182074d2c97a26 100644 (file)
@@ -36,8 +36,4 @@ extern av_export_avcodec const uint8_t avpriv_mjpeg_val_ac_luminance[];
 extern av_export_avcodec const uint8_t avpriv_mjpeg_bits_ac_chrominance[];
 extern av_export_avcodec const uint8_t avpriv_mjpeg_val_ac_chrominance[];
 
-void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
-                                  const uint8_t *bits_table,
-                                  const uint8_t *val_table);
-
 #endif /* AVCODEC_JPEGTABLES_H */
index 0b82777ec94afe4ee4c887a981d64c2bb641fbdc..720b18d44886f42cae11ddfa871ce1dd75bd21f0 100644 (file)
@@ -466,6 +466,27 @@ void ff_mjpeg_escape_FF(PutBitContext *pb, int start)
     }
 }
 
+/* isn't this function nicer than the one in the libjpeg ? */
+void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
+                                  const uint8_t *bits_table,
+                                  const uint8_t *val_table)
+{
+    int k, code;
+
+    k = 0;
+    code = 0;
+    for (int i = 1; i <= 16; i++) {
+        int nb = bits_table[i];
+        for (int j = 0; j < nb; j++) {
+            int sym = val_table[k++];
+            huff_size[sym] = i;
+            huff_code[sym] = code;
+            code++;
+        }
+        code <<= 1;
+    }
+}
+
 /**
  * Builds all 4 optimal Huffman tables.
  *
index e8698d18c6685a816a8b81a83b1c8bb04aadae5a..b432baac3e4ce6b64abf7568b2308e3e6e4c36da 100644 (file)
@@ -35,6 +35,9 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
 void ff_mjpeg_encode_picture_frame(MpegEncContext *s);
 void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits);
 void ff_mjpeg_escape_FF(PutBitContext *pb, int start);
+void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
+                                  const uint8_t *bits_table,
+                                  const uint8_t *val_table);
 int ff_mjpeg_encode_stuffing(MpegEncContext *s);
 void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[4], int vsample[4]);