From 944721c16082c9951cf8b5efe0e6820f6e92fe01 Mon Sep 17 00:00:00 2001 From: Aurelien Jacobs Date: Thu, 17 May 2007 16:45:55 +0000 Subject: [PATCH] add proper prefix to new mjpeg extern func/var Originally committed as revision 9049 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mjpeg.c | 21 +++++++++++---------- libavcodec/mjpeg.h | 21 +++++++++++---------- libavcodec/mjpegdec.c | 14 +++++++++----- libavcodec/mjpegenc.c | 44 +++++++++++++++++++++++-------------------- 4 files changed, 55 insertions(+), 45 deletions(-) diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c index ab855fc2f0..4be987b2cf 100644 --- a/libavcodec/mjpeg.c +++ b/libavcodec/mjpeg.c @@ -62,19 +62,19 @@ const unsigned char std_chrominance_quant_tbl[64] = { /* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ /* IMPORTANT: these are only valid for 8-bit data precision! */ -const uint8_t bits_dc_luminance[17] = +const uint8_t ff_mjpeg_bits_dc_luminance[17] = { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; -const uint8_t val_dc_luminance[] = +const uint8_t ff_mjpeg_val_dc_luminance[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; -const uint8_t bits_dc_chrominance[17] = +const uint8_t ff_mjpeg_bits_dc_chrominance[17] = { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; -const uint8_t val_dc_chrominance[] = +const uint8_t ff_mjpeg_val_dc_chrominance[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; -const uint8_t bits_ac_luminance[17] = +const uint8_t ff_mjpeg_bits_ac_luminance[17] = { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; -const uint8_t val_ac_luminance[] = +const uint8_t ff_mjpeg_val_ac_luminance[] = { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, @@ -98,10 +98,10 @@ const uint8_t val_ac_luminance[] = 0xf9, 0xfa }; -const uint8_t bits_ac_chrominance[17] = +const uint8_t ff_mjpeg_bits_ac_chrominance[17] = { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; -const uint8_t val_ac_chrominance[] = +const uint8_t ff_mjpeg_val_ac_chrominance[] = { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, @@ -126,8 +126,9 @@ const uint8_t val_ac_chrominance[] = }; /* isn't this function nicer than the one in the libjpeg ? */ -void build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code, - const uint8_t *bits_table, const uint8_t *val_table) +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; diff --git a/libavcodec/mjpeg.h b/libavcodec/mjpeg.h index 7030b1784c..4009b4a02a 100644 --- a/libavcodec/mjpeg.h +++ b/libavcodec/mjpeg.h @@ -204,19 +204,20 @@ typedef struct MJpegDecodeContext { case 7: ret= (left + top)>>1; break;\ } -extern const uint8_t bits_dc_luminance[]; -extern const uint8_t val_dc_luminance[]; +extern const uint8_t ff_mjpeg_bits_dc_luminance[]; +extern const uint8_t ff_mjpeg_val_dc_luminance[]; -extern const uint8_t bits_dc_chrominance[]; -extern const uint8_t val_dc_chrominance[]; +extern const uint8_t ff_mjpeg_bits_dc_chrominance[]; +extern const uint8_t ff_mjpeg_val_dc_chrominance[]; -extern const uint8_t bits_ac_luminance[]; -extern const uint8_t val_ac_luminance[]; +extern const uint8_t ff_mjpeg_bits_ac_luminance[]; +extern const uint8_t ff_mjpeg_val_ac_luminance[]; -extern const uint8_t bits_ac_chrominance[]; -extern const uint8_t val_ac_chrominance[]; +extern const uint8_t ff_mjpeg_bits_ac_chrominance[]; +extern const uint8_t ff_mjpeg_val_ac_chrominance[]; -void build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code, - const uint8_t *bits_table, const uint8_t *val_table); +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 /* MJPEG_H */ diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index b3ced4d5fc..274dae7946 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -51,7 +51,7 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_tab assert(nb_codes <= 256); memset(huff_size, 0, sizeof(huff_size)); - build_huffman_codes(huff_size, huff_code, bits_table, val_table); + ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table); if(is_ac){ memmove(huff_size+16, huff_size, sizeof(uint8_t)*nb_codes); @@ -77,10 +77,14 @@ static int mjpeg_decode_init(AVCodecContext *avctx) s->first_picture = 1; s->org_height = avctx->coded_height; - build_vlc(&s->vlcs[0][0], bits_dc_luminance, val_dc_luminance, 12, 0, 0); - build_vlc(&s->vlcs[0][1], bits_dc_chrominance, val_dc_chrominance, 12, 0, 0); - build_vlc(&s->vlcs[1][0], bits_ac_luminance, val_ac_luminance, 251, 0, 1); - build_vlc(&s->vlcs[1][1], bits_ac_chrominance, val_ac_chrominance, 251, 0, 1); + build_vlc(&s->vlcs[0][0], ff_mjpeg_bits_dc_luminance, + ff_mjpeg_val_dc_luminance, 12, 0, 0); + build_vlc(&s->vlcs[0][1], ff_mjpeg_bits_dc_chrominance, + ff_mjpeg_val_dc_chrominance, 12, 0, 0); + build_vlc(&s->vlcs[1][0], ff_mjpeg_bits_ac_luminance, + ff_mjpeg_val_ac_luminance, 251, 0, 1); + build_vlc(&s->vlcs[1][1], ff_mjpeg_bits_ac_chrominance, + ff_mjpeg_val_ac_chrominance, 251, 0, 1); if (avctx->flags & CODEC_FLAG_EXTERN_HUFF) { diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index 11967fe01a..53aae5c287 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -67,22 +67,22 @@ int mjpeg_init(MpegEncContext *s) s->max_qcoeff= 1023; /* build all the huffman tables */ - build_huffman_codes(m->huff_size_dc_luminance, - m->huff_code_dc_luminance, - bits_dc_luminance, - val_dc_luminance); - build_huffman_codes(m->huff_size_dc_chrominance, - m->huff_code_dc_chrominance, - bits_dc_chrominance, - val_dc_chrominance); - build_huffman_codes(m->huff_size_ac_luminance, - m->huff_code_ac_luminance, - bits_ac_luminance, - val_ac_luminance); - build_huffman_codes(m->huff_size_ac_chrominance, - m->huff_code_ac_chrominance, - bits_ac_chrominance, - val_ac_chrominance); + ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance, + m->huff_code_dc_luminance, + ff_mjpeg_bits_dc_luminance, + ff_mjpeg_val_dc_luminance); + ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance, + m->huff_code_dc_chrominance, + ff_mjpeg_bits_dc_chrominance, + ff_mjpeg_val_dc_chrominance); + ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance, + m->huff_code_ac_luminance, + ff_mjpeg_bits_ac_luminance, + ff_mjpeg_val_ac_luminance); + ff_mjpeg_build_huffman_codes(m->huff_size_ac_chrominance, + m->huff_code_ac_chrominance, + ff_mjpeg_bits_ac_chrominance, + ff_mjpeg_val_ac_chrominance); s->mjpeg_ctx = m; return 0; @@ -149,11 +149,15 @@ static void jpeg_table_header(MpegEncContext *s) ptr = pbBufPtr(p); put_bits(p, 16, 0); /* patched later */ size = 2; - size += put_huffman_table(s, 0, 0, bits_dc_luminance, val_dc_luminance); - size += put_huffman_table(s, 0, 1, bits_dc_chrominance, val_dc_chrominance); + size += put_huffman_table(s, 0, 0, ff_mjpeg_bits_dc_luminance, + ff_mjpeg_val_dc_luminance); + size += put_huffman_table(s, 0, 1, ff_mjpeg_bits_dc_chrominance, + ff_mjpeg_val_dc_chrominance); - size += put_huffman_table(s, 1, 0, bits_ac_luminance, val_ac_luminance); - size += put_huffman_table(s, 1, 1, bits_ac_chrominance, val_ac_chrominance); + size += put_huffman_table(s, 1, 0, ff_mjpeg_bits_ac_luminance, + ff_mjpeg_val_ac_luminance); + size += put_huffman_table(s, 1, 1, ff_mjpeg_bits_ac_chrominance, + ff_mjpeg_val_ac_chrominance); ptr[0] = size >> 8; ptr[1] = size; }