mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/jpegtables: Unavpriv MJPEG-tables
There are seven MJPEG-tables, five small (1x12, 4x17) and two not small (2x162). These are all avpriv, despite this not being worthwhile due to the overhead of exporting a symbol: The total overhead for each symbol consists of two entries in .dynsym (24B each), one entry in the importing library's .rela.dyn (24B) and one in .got (8B) as well as 2x2B for symbol versions and 4B for symbol hashes in the exporting library; in addition to that, the name of the symbol is included in both exporting and importing libraries, using 2x210 bytes in this case. (The above numbers are for a x64 Elf/Linux/GNU system. Other platforms will give different numbers.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
3afb41655e
commit
1d333c1547
3
configure
vendored
3
configure
vendored
@ -3451,9 +3451,8 @@ ogv_muxer_select="ogg_muxer"
|
||||
opus_muxer_select="ogg_muxer"
|
||||
psp_muxer_select="mov_muxer"
|
||||
rtp_demuxer_select="sdp_demuxer"
|
||||
rtp_muxer_select="jpegtables"
|
||||
rtp_mpegts_muxer_select="mpegts_muxer rtp_muxer"
|
||||
rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
|
||||
rtpdec_select="asf_demuxer mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
|
||||
rtsp_demuxer_select="http_protocol rtpdec"
|
||||
rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
|
||||
sap_demuxer_select="sdp_demuxer"
|
||||
|
@ -1005,7 +1005,8 @@ OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o
|
||||
STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o
|
||||
STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o
|
||||
STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o
|
||||
STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o
|
||||
STLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o
|
||||
STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o jpegtables.o
|
||||
STLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o
|
||||
|
||||
# libavfilter dependencies
|
||||
|
@ -164,20 +164,20 @@ static av_cold int jpg_init(AVCodecContext *avctx, JPGContext *c)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ff_mjpeg_build_vlc(&c->dc_vlc[0], avpriv_mjpeg_bits_dc_luminance,
|
||||
avpriv_mjpeg_val_dc, 0, avctx);
|
||||
ret = ff_mjpeg_build_vlc(&c->dc_vlc[0], ff_mjpeg_bits_dc_luminance,
|
||||
ff_mjpeg_val_dc, 0, avctx);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = ff_mjpeg_build_vlc(&c->dc_vlc[1], avpriv_mjpeg_bits_dc_chrominance,
|
||||
avpriv_mjpeg_val_dc, 0, avctx);
|
||||
ret = ff_mjpeg_build_vlc(&c->dc_vlc[1], ff_mjpeg_bits_dc_chrominance,
|
||||
ff_mjpeg_val_dc, 0, avctx);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = ff_mjpeg_build_vlc(&c->ac_vlc[0], avpriv_mjpeg_bits_ac_luminance,
|
||||
avpriv_mjpeg_val_ac_luminance, 1, avctx);
|
||||
ret = ff_mjpeg_build_vlc(&c->ac_vlc[0], ff_mjpeg_bits_ac_luminance,
|
||||
ff_mjpeg_val_ac_luminance, 1, avctx);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = ff_mjpeg_build_vlc(&c->ac_vlc[1], avpriv_mjpeg_bits_ac_chrominance,
|
||||
avpriv_mjpeg_val_ac_chrominance, 1, avctx);
|
||||
ret = ff_mjpeg_build_vlc(&c->ac_vlc[1], ff_mjpeg_bits_ac_chrominance,
|
||||
ff_mjpeg_val_ac_chrominance, 1, avctx);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -30,8 +30,7 @@
|
||||
* MJPEG encoder and decoder.
|
||||
*/
|
||||
|
||||
#include "jpegtables.h"
|
||||
|
||||
#include "jpegtabs.h"
|
||||
|
||||
#if 0
|
||||
/* These are the sample quantization tables given in JPEG spec section K.1.
|
||||
@ -59,66 +58,3 @@ static const unsigned char std_chrominance_quant_tbl[64] = {
|
||||
99, 99, 99, 99, 99, 99, 99, 99
|
||||
};
|
||||
#endif
|
||||
|
||||
/* 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 avpriv_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 avpriv_mjpeg_val_dc[12] =
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
|
||||
|
||||
const uint8_t avpriv_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 avpriv_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 avpriv_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,
|
||||
0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
|
||||
0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
|
||||
0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
|
||||
0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
|
||||
0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
|
||||
0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||
0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
|
||||
0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
|
||||
0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
|
||||
0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
|
||||
0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
||||
0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
|
||||
0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
|
||||
0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
|
||||
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
|
||||
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
|
||||
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa
|
||||
};
|
||||
|
||||
const uint8_t avpriv_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 avpriv_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,
|
||||
0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
|
||||
0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
|
||||
0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
|
||||
0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
|
||||
0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
|
||||
0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
|
||||
0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
|
||||
0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
|
||||
0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
|
||||
0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
|
||||
0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
|
||||
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
|
||||
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa
|
||||
};
|
||||
|
@ -23,17 +23,15 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "internal.h"
|
||||
extern const uint8_t ff_mjpeg_bits_dc_luminance[];
|
||||
extern const uint8_t ff_mjpeg_val_dc[];
|
||||
|
||||
extern av_export_avcodec const uint8_t avpriv_mjpeg_bits_dc_luminance[];
|
||||
extern av_export_avcodec const uint8_t avpriv_mjpeg_val_dc[];
|
||||
extern const uint8_t ff_mjpeg_bits_dc_chrominance[];
|
||||
|
||||
extern av_export_avcodec const uint8_t avpriv_mjpeg_bits_dc_chrominance[];
|
||||
extern const uint8_t ff_mjpeg_bits_ac_luminance[];
|
||||
extern const uint8_t ff_mjpeg_val_ac_luminance[];
|
||||
|
||||
extern av_export_avcodec const uint8_t avpriv_mjpeg_bits_ac_luminance[];
|
||||
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[];
|
||||
extern const uint8_t ff_mjpeg_bits_ac_chrominance[];
|
||||
extern const uint8_t ff_mjpeg_val_ac_chrominance[];
|
||||
|
||||
#endif /* AVCODEC_JPEGTABLES_H */
|
||||
|
92
libavcodec/jpegtabs.h
Normal file
92
libavcodec/jpegtabs.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* MJPEG tables
|
||||
* Copyright (c) 2000, 2001 Fabrice Bellard
|
||||
* Copyright (c) 2003 Alex Beregszaszi
|
||||
* Copyright (c) 2003-2004 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_JPEGTABS_H
|
||||
#define AVCODEC_JPEGTABS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "jpegtables.h"
|
||||
|
||||
/* 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 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 ff_mjpeg_val_dc[12] =
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
|
||||
|
||||
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 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 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,
|
||||
0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
|
||||
0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
|
||||
0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
|
||||
0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
|
||||
0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
|
||||
0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||
0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
|
||||
0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
|
||||
0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
|
||||
0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
|
||||
0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
||||
0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
|
||||
0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
|
||||
0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
|
||||
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
|
||||
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
|
||||
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa
|
||||
};
|
||||
|
||||
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 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,
|
||||
0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
|
||||
0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
|
||||
0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
|
||||
0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
|
||||
0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
|
||||
0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
|
||||
0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
|
||||
0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
|
||||
0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
|
||||
0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
|
||||
0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
|
||||
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
|
||||
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa
|
||||
};
|
||||
#endif
|
@ -293,12 +293,12 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx)
|
||||
|
||||
ff_mjpeg_build_huffman_codes(s->huff_size_dc_luminance,
|
||||
s->huff_code_dc_luminance,
|
||||
avpriv_mjpeg_bits_dc_luminance,
|
||||
avpriv_mjpeg_val_dc);
|
||||
ff_mjpeg_bits_dc_luminance,
|
||||
ff_mjpeg_val_dc);
|
||||
ff_mjpeg_build_huffman_codes(s->huff_size_dc_chrominance,
|
||||
s->huff_code_dc_chrominance,
|
||||
avpriv_mjpeg_bits_dc_chrominance,
|
||||
avpriv_mjpeg_val_dc);
|
||||
ff_mjpeg_bits_dc_chrominance,
|
||||
ff_mjpeg_val_dc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -65,15 +65,15 @@ static uint8_t *append(uint8_t *buf, const uint8_t *src, int size)
|
||||
static uint8_t *append_dht_segment(uint8_t *buf)
|
||||
{
|
||||
buf = append(buf, dht_segment_head, sizeof(dht_segment_head));
|
||||
buf = append(buf, avpriv_mjpeg_bits_dc_luminance + 1, 16);
|
||||
buf = append(buf, ff_mjpeg_bits_dc_luminance + 1, 16);
|
||||
buf = append(buf, dht_segment_frag, sizeof(dht_segment_frag));
|
||||
buf = append(buf, avpriv_mjpeg_val_dc, 12);
|
||||
buf = append(buf, ff_mjpeg_val_dc, 12);
|
||||
*(buf++) = 0x10;
|
||||
buf = append(buf, avpriv_mjpeg_bits_ac_luminance + 1, 16);
|
||||
buf = append(buf, avpriv_mjpeg_val_ac_luminance, 162);
|
||||
buf = append(buf, ff_mjpeg_bits_ac_luminance + 1, 16);
|
||||
buf = append(buf, ff_mjpeg_val_ac_luminance, 162);
|
||||
*(buf++) = 0x11;
|
||||
buf = append(buf, avpriv_mjpeg_bits_ac_chrominance + 1, 16);
|
||||
buf = append(buf, avpriv_mjpeg_val_ac_chrominance, 162);
|
||||
buf = append(buf, ff_mjpeg_bits_ac_chrominance + 1, 16);
|
||||
buf = append(buf, ff_mjpeg_val_ac_chrominance, 162);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -61,18 +61,18 @@ static int init_default_huffman_tables(MJpegDecodeContext *s)
|
||||
const uint8_t *values;
|
||||
int length;
|
||||
} ht[] = {
|
||||
{ 0, 0, avpriv_mjpeg_bits_dc_luminance,
|
||||
avpriv_mjpeg_val_dc, 12 },
|
||||
{ 0, 1, avpriv_mjpeg_bits_dc_chrominance,
|
||||
avpriv_mjpeg_val_dc, 12 },
|
||||
{ 1, 0, avpriv_mjpeg_bits_ac_luminance,
|
||||
avpriv_mjpeg_val_ac_luminance, 162 },
|
||||
{ 1, 1, avpriv_mjpeg_bits_ac_chrominance,
|
||||
avpriv_mjpeg_val_ac_chrominance, 162 },
|
||||
{ 2, 0, avpriv_mjpeg_bits_ac_luminance,
|
||||
avpriv_mjpeg_val_ac_luminance, 162 },
|
||||
{ 2, 1, avpriv_mjpeg_bits_ac_chrominance,
|
||||
avpriv_mjpeg_val_ac_chrominance, 162 },
|
||||
{ 0, 0, ff_mjpeg_bits_dc_luminance,
|
||||
ff_mjpeg_val_dc, 12 },
|
||||
{ 0, 1, ff_mjpeg_bits_dc_chrominance,
|
||||
ff_mjpeg_val_dc, 12 },
|
||||
{ 1, 0, ff_mjpeg_bits_ac_luminance,
|
||||
ff_mjpeg_val_ac_luminance, 162 },
|
||||
{ 1, 1, ff_mjpeg_bits_ac_chrominance,
|
||||
ff_mjpeg_val_ac_chrominance, 162 },
|
||||
{ 2, 0, ff_mjpeg_bits_ac_luminance,
|
||||
ff_mjpeg_val_ac_luminance, 162 },
|
||||
{ 2, 1, ff_mjpeg_bits_ac_chrominance,
|
||||
ff_mjpeg_val_ac_chrominance, 162 },
|
||||
};
|
||||
int i, ret;
|
||||
|
||||
|
@ -288,20 +288,20 @@ av_cold int ff_mjpeg_encode_init(MpegEncContext *s)
|
||||
// they are needed at least right now for some processes like trellis.
|
||||
ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance,
|
||||
m->huff_code_dc_luminance,
|
||||
avpriv_mjpeg_bits_dc_luminance,
|
||||
avpriv_mjpeg_val_dc);
|
||||
ff_mjpeg_bits_dc_luminance,
|
||||
ff_mjpeg_val_dc);
|
||||
ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance,
|
||||
m->huff_code_dc_chrominance,
|
||||
avpriv_mjpeg_bits_dc_chrominance,
|
||||
avpriv_mjpeg_val_dc);
|
||||
ff_mjpeg_bits_dc_chrominance,
|
||||
ff_mjpeg_val_dc);
|
||||
ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance,
|
||||
m->huff_code_ac_luminance,
|
||||
avpriv_mjpeg_bits_ac_luminance,
|
||||
avpriv_mjpeg_val_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,
|
||||
avpriv_mjpeg_bits_ac_chrominance,
|
||||
avpriv_mjpeg_val_ac_chrominance);
|
||||
ff_mjpeg_bits_ac_chrominance,
|
||||
ff_mjpeg_val_ac_chrominance);
|
||||
|
||||
init_uni_ac_vlc(m->huff_size_ac_luminance, m->uni_ac_vlc_len);
|
||||
init_uni_ac_vlc(m->huff_size_ac_chrominance, m->uni_chroma_ac_vlc_len);
|
||||
|
@ -121,15 +121,15 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
|
||||
size += put_huffman_table(p, 1, 1, s->mjpeg_ctx->bits_ac_chrominance,
|
||||
s->mjpeg_ctx->val_ac_chrominance);
|
||||
} else {
|
||||
size += put_huffman_table(p, 0, 0, avpriv_mjpeg_bits_dc_luminance,
|
||||
avpriv_mjpeg_val_dc);
|
||||
size += put_huffman_table(p, 0, 1, avpriv_mjpeg_bits_dc_chrominance,
|
||||
avpriv_mjpeg_val_dc);
|
||||
size += put_huffman_table(p, 0, 0, ff_mjpeg_bits_dc_luminance,
|
||||
ff_mjpeg_val_dc);
|
||||
size += put_huffman_table(p, 0, 1, ff_mjpeg_bits_dc_chrominance,
|
||||
ff_mjpeg_val_dc);
|
||||
|
||||
size += put_huffman_table(p, 1, 0, avpriv_mjpeg_bits_ac_luminance,
|
||||
avpriv_mjpeg_val_ac_luminance);
|
||||
size += put_huffman_table(p, 1, 1, avpriv_mjpeg_bits_ac_chrominance,
|
||||
avpriv_mjpeg_val_ac_chrominance);
|
||||
size += put_huffman_table(p, 1, 0, ff_mjpeg_bits_ac_luminance,
|
||||
ff_mjpeg_val_ac_luminance);
|
||||
size += put_huffman_table(p, 1, 1, ff_mjpeg_bits_ac_chrominance,
|
||||
ff_mjpeg_val_ac_chrominance);
|
||||
}
|
||||
AV_WB16(ptr, size);
|
||||
}
|
||||
|
@ -124,10 +124,10 @@ static av_cold void mss4_init_vlcs(void)
|
||||
for (unsigned i = 0, offset = 0; i < 2; i++) {
|
||||
mss4_init_vlc(&dc_vlc[i], &offset, mss4_dc_vlc_lens[i], NULL);
|
||||
mss4_init_vlc(&ac_vlc[i], &offset,
|
||||
i ? avpriv_mjpeg_bits_ac_chrominance + 1
|
||||
: avpriv_mjpeg_bits_ac_luminance + 1,
|
||||
i ? avpriv_mjpeg_val_ac_chrominance
|
||||
: avpriv_mjpeg_val_ac_luminance);
|
||||
i ? ff_mjpeg_bits_ac_chrominance + 1
|
||||
: ff_mjpeg_bits_ac_luminance + 1,
|
||||
i ? ff_mjpeg_val_ac_chrominance
|
||||
: ff_mjpeg_val_ac_luminance);
|
||||
mss4_init_vlc(&vec_entry_vlc[i], &offset, mss4_vec_entry_vlc_lens[i],
|
||||
mss4_vec_entry_vlc_syms[i]);
|
||||
}
|
||||
|
@ -327,20 +327,20 @@ static int vaapi_encode_mjpeg_init_picture_params(AVCodecContext *avctx,
|
||||
|
||||
switch (t) {
|
||||
case 0:
|
||||
lengths = avpriv_mjpeg_bits_dc_luminance + 1;
|
||||
values = avpriv_mjpeg_val_dc;
|
||||
lengths = ff_mjpeg_bits_dc_luminance + 1;
|
||||
values = ff_mjpeg_val_dc;
|
||||
break;
|
||||
case 1:
|
||||
lengths = avpriv_mjpeg_bits_ac_luminance + 1;
|
||||
values = avpriv_mjpeg_val_ac_luminance;
|
||||
lengths = ff_mjpeg_bits_ac_luminance + 1;
|
||||
values = ff_mjpeg_val_ac_luminance;
|
||||
break;
|
||||
case 2:
|
||||
lengths = avpriv_mjpeg_bits_dc_chrominance + 1;
|
||||
values = avpriv_mjpeg_val_dc;
|
||||
lengths = ff_mjpeg_bits_dc_chrominance + 1;
|
||||
values = ff_mjpeg_val_dc;
|
||||
break;
|
||||
case 3:
|
||||
lengths = avpriv_mjpeg_bits_ac_chrominance + 1;
|
||||
values = avpriv_mjpeg_val_ac_chrominance;
|
||||
lengths = ff_mjpeg_bits_ac_chrominance + 1;
|
||||
values = ff_mjpeg_val_ac_chrominance;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,8 @@ SHLIBOBJS += log2_tab.o
|
||||
SHLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o
|
||||
SHLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o
|
||||
SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o
|
||||
SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o
|
||||
SHLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o
|
||||
SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o jpegtables.o
|
||||
SHLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o
|
||||
|
||||
# libavdevice dependencies
|
||||
|
24
libavformat/jpegtables.c
Normal file
24
libavformat/jpegtables.c
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* MJPEG tables
|
||||
* Copyright (c) 2000, 2001 Fabrice Bellard
|
||||
* Copyright (c) 2003 Alex Beregszaszi
|
||||
* Copyright (c) 2003-2004 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "libavcodec/jpegtabs.h"
|
@ -144,14 +144,14 @@ static int jpeg_create_header(uint8_t *buf, int size, uint32_t type, uint32_t w,
|
||||
bytestream2_put_be16(&pbc, 0);
|
||||
|
||||
dht_size = 2;
|
||||
dht_size += jpeg_create_huffman_table(&pbc, 0, 0,avpriv_mjpeg_bits_dc_luminance,
|
||||
avpriv_mjpeg_val_dc);
|
||||
dht_size += jpeg_create_huffman_table(&pbc, 0, 1, avpriv_mjpeg_bits_dc_chrominance,
|
||||
avpriv_mjpeg_val_dc);
|
||||
dht_size += jpeg_create_huffman_table(&pbc, 1, 0, avpriv_mjpeg_bits_ac_luminance,
|
||||
avpriv_mjpeg_val_ac_luminance);
|
||||
dht_size += jpeg_create_huffman_table(&pbc, 1, 1, avpriv_mjpeg_bits_ac_chrominance,
|
||||
avpriv_mjpeg_val_ac_chrominance);
|
||||
dht_size += jpeg_create_huffman_table(&pbc, 0, 0,ff_mjpeg_bits_dc_luminance,
|
||||
ff_mjpeg_val_dc);
|
||||
dht_size += jpeg_create_huffman_table(&pbc, 0, 1, ff_mjpeg_bits_dc_chrominance,
|
||||
ff_mjpeg_val_dc);
|
||||
dht_size += jpeg_create_huffman_table(&pbc, 1, 0, ff_mjpeg_bits_ac_luminance,
|
||||
ff_mjpeg_val_ac_luminance);
|
||||
dht_size += jpeg_create_huffman_table(&pbc, 1, 1, ff_mjpeg_bits_ac_chrominance,
|
||||
ff_mjpeg_val_ac_chrominance);
|
||||
AV_WB16(dht_size_ptr, dht_size);
|
||||
|
||||
/* SOF0 */
|
||||
|
@ -101,8 +101,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
|
||||
switch (buf[i + 1]) {
|
||||
case 0x00:
|
||||
if ( dht_size >= 29
|
||||
&& !memcmp(buf + i + 2, avpriv_mjpeg_bits_dc_luminance + 1, 16)
|
||||
&& !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) {
|
||||
&& !memcmp(buf + i + 2, ff_mjpeg_bits_dc_luminance + 1, 16)
|
||||
&& !memcmp(buf + i + 18, ff_mjpeg_val_dc, 12)) {
|
||||
default_huffman_tables |= 1;
|
||||
i += 29;
|
||||
dht_size -= 29;
|
||||
@ -113,8 +113,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
|
||||
break;
|
||||
case 0x01:
|
||||
if ( dht_size >= 29
|
||||
&& !memcmp(buf + i + 2, avpriv_mjpeg_bits_dc_chrominance + 1, 16)
|
||||
&& !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) {
|
||||
&& !memcmp(buf + i + 2, ff_mjpeg_bits_dc_chrominance + 1, 16)
|
||||
&& !memcmp(buf + i + 18, ff_mjpeg_val_dc, 12)) {
|
||||
default_huffman_tables |= 1 << 1;
|
||||
i += 29;
|
||||
dht_size -= 29;
|
||||
@ -125,8 +125,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
|
||||
break;
|
||||
case 0x10:
|
||||
if ( dht_size >= 179
|
||||
&& !memcmp(buf + i + 2, avpriv_mjpeg_bits_ac_luminance + 1, 16)
|
||||
&& !memcmp(buf + i + 18, avpriv_mjpeg_val_ac_luminance, 162)) {
|
||||
&& !memcmp(buf + i + 2, ff_mjpeg_bits_ac_luminance + 1, 16)
|
||||
&& !memcmp(buf + i + 18, ff_mjpeg_val_ac_luminance, 162)) {
|
||||
default_huffman_tables |= 1 << 2;
|
||||
i += 179;
|
||||
dht_size -= 179;
|
||||
@ -137,8 +137,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
|
||||
break;
|
||||
case 0x11:
|
||||
if ( dht_size >= 179
|
||||
&& !memcmp(buf + i + 2, avpriv_mjpeg_bits_ac_chrominance + 1, 16)
|
||||
&& !memcmp(buf + i + 18, avpriv_mjpeg_val_ac_chrominance, 162)) {
|
||||
&& !memcmp(buf + i + 2, ff_mjpeg_bits_ac_chrominance + 1, 16)
|
||||
&& !memcmp(buf + i + 18, ff_mjpeg_val_ac_chrominance, 162)) {
|
||||
default_huffman_tables |= 1 << 3;
|
||||
i += 179;
|
||||
dht_size -= 179;
|
||||
|
Loading…
Reference in New Issue
Block a user