diff --git a/configure b/configure index e1849a244a..392946adff 100755 --- a/configure +++ b/configure @@ -1880,6 +1880,7 @@ CONFIG_EXTRA=" iirfilter imdct15 intrax8 + jpegtables lgplv3 llauddsp llviddsp @@ -2095,7 +2096,7 @@ als_decoder_select="bswapdsp" amrnb_decoder_select="lsp" amrwb_decoder_select="lsp" amv_decoder_select="sp5x_decoder exif" -amv_encoder_select="aandcttables mpegvideoenc" +amv_encoder_select="aandcttables jpegtables mpegvideoenc" ape_decoder_select="bswapdsp llauddsp" apng_decoder_select="zlib" asv1_decoder_select="blockdsp bswapdsp idctdsp" @@ -2105,7 +2106,7 @@ asv2_encoder_select="bswapdsp fdctdsp pixblockdsp" atrac1_decoder_select="mdct sinewin" atrac3_decoder_select="mdct" atrac3p_decoder_select="mdct sinewin" -avrn_decoder_select="exif" +avrn_decoder_select="exif jpegtables" bink_decoder_select="blockdsp hpeldsp" binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs" binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs" @@ -2143,7 +2144,7 @@ flv_decoder_select="h263_decoder" flv_encoder_select="h263_encoder" fourxm_decoder_select="blockdsp bswapdsp" fraps_decoder_select="bswapdsp huffman" -g2m_decoder_select="blockdsp idctdsp zlib" +g2m_decoder_select="blockdsp idctdsp jpegtables zlib" g729_decoder_select="audiodsp" h261_decoder_select="mpeg_er mpegvideo" h261_encoder_select="aandcttables mpegvideoenc" @@ -2168,13 +2169,13 @@ jpegls_decoder_select="golomb mjpeg_decoder" jpegls_encoder_select="golomb" jv_decoder_select="blockdsp" lagarith_decoder_select="huffyuvdsp" -ljpeg_encoder_select="aandcttables idctdsp" +ljpeg_encoder_select="aandcttables idctdsp jpegtables" loco_decoder_select="golomb" mdec_decoder_select="blockdsp idctdsp mpegvideo" metasound_decoder_select="lsp mdct sinewin" mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp" -mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp" -mjpeg_encoder_select="aandcttables mpegvideoenc" +mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables" +mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc" mjpegb_decoder_select="mjpeg_decoder" mlp_decoder_select="mlp_parser" motionpixels_decoder_select="bswapdsp" @@ -2371,6 +2372,9 @@ mpegvideo_parser_select="mpegvideo" mpeg4video_parser_select="error_resilience h263dsp mpeg_er mpegvideo qpeldsp" vc1_parser_select="mpegvideo startcode vc1_decoder" +# bitstream_filters +mjpeg2jpeg_bsf_select="jpegtables" + # external libraries libaacplus_encoder_deps="libaacplus" libcelt_decoder_deps="libcelt" @@ -2484,7 +2488,7 @@ ogg_demuxer_select="golomb" opus_muxer_select="ogg_muxer" psp_muxer_select="mov_muxer" rtp_demuxer_select="sdp_demuxer" -rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer" +rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol" rtsp_demuxer_select="http_protocol rtpdec" rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain" sap_demuxer_select="sdp_demuxer" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 6e6285a934..f8e27320c2 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -70,6 +70,7 @@ OBJS-$(CONFIG_IDCTDSP) += idctdsp.o simple_idct.o jrevdct.o OBJS-$(CONFIG_IIRFILTER) += iirfilter.o OBJS-$(CONFIG_IMDCT15) += imdct15.o OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o +OBJS-$(CONFIG_JPEGTABLES) += jpegtables.o OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o OBJS-$(CONFIG_LLAUDDSP) += lossless_audiodsp.o OBJS-$(CONFIG_LLVIDDSP) += lossless_videodsp.o @@ -136,7 +137,7 @@ OBJS-$(CONFIG_AMRWB_DECODER) += amrwbdec.o celp_filters.o \ celp_math.o acelp_filters.o \ acelp_vectors.o \ acelp_pitch_delay.o -OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpeg.o mjpegenc_common.o \ +OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpegenc_common.o \ mpegvideo_enc.o motion_est.o \ ratecontrol.o mpeg12data.o \ mpegvideo.o @@ -158,7 +159,7 @@ OBJS-$(CONFIG_ATRAC3P_DECODER) += atrac3plusdec.o atrac3plus.o \ atrac3plusdsp.o atrac.o OBJS-$(CONFIG_AURA_DECODER) += cyuv.o OBJS-$(CONFIG_AURA2_DECODER) += aura.o -OBJS-$(CONFIG_AVRN_DECODER) += avrndec.o mjpegdec.o mjpeg.o +OBJS-$(CONFIG_AVRN_DECODER) += avrndec.o mjpegdec.o OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o OBJS-$(CONFIG_AVS_DECODER) += avs.o @@ -249,7 +250,7 @@ OBJS-$(CONFIG_FLIC_DECODER) += flicvideo.o OBJS-$(CONFIG_FOURXM_DECODER) += 4xm.o OBJS-$(CONFIG_FRAPS_DECODER) += fraps.o OBJS-$(CONFIG_FRWU_DECODER) += frwu.o -OBJS-$(CONFIG_G2M_DECODER) += g2meet.o mjpeg.o +OBJS-$(CONFIG_G2M_DECODER) += g2meet.o OBJS-$(CONFIG_G723_1_DECODER) += g723_1.o acelp_vectors.o \ celp_filters.o celp_math.o OBJS-$(CONFIG_G723_1_ENCODER) += g723_1.o acelp_vectors.o celp_math.o @@ -302,7 +303,7 @@ OBJS-$(CONFIG_JV_DECODER) += jvdec.o OBJS-$(CONFIG_KGV1_DECODER) += kgv1dec.o OBJS-$(CONFIG_KMVC_DECODER) += kmvc.o OBJS-$(CONFIG_LAGARITH_DECODER) += lagarith.o lagarithrac.o -OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpeg.o mjpegenc_common.o +OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc_common.o OBJS-$(CONFIG_LOCO_DECODER) += loco.o OBJS-$(CONFIG_MACE3_DECODER) += mace.o OBJS-$(CONFIG_MACE6_DECODER) += mace.o @@ -311,8 +312,8 @@ OBJS-$(CONFIG_METASOUND_DECODER) += metasound.o metasound_data.o \ twinvq.o OBJS-$(CONFIG_MICRODVD_DECODER) += microdvddec.o ass.o OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o -OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o mjpeg.o -OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o mjpegenc_common.o +OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o +OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpegenc_common.o OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o OBJS-$(CONFIG_MLP_DECODER) += mlpdec.o mlpdsp.o OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o @@ -721,7 +722,6 @@ OBJS-$(CONFIG_OGG_DEMUXER) += mpeg12data.o \ OBJS-$(CONFIG_OGG_MUXER) += flac.o flacdata.o \ vorbis_data.o OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o -OBJS-$(CONFIG_RTPDEC) += mjpeg.o OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o OBJS-$(CONFIG_SPDIF_MUXER) += dca.o OBJS-$(CONFIG_TAK_DEMUXER) += tak.o @@ -838,7 +838,7 @@ OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o -OBJS-$(CONFIG_MJPEG2JPEG_BSF) += mjpeg2jpeg_bsf.o mjpeg.o +OBJS-$(CONFIG_MJPEG2JPEG_BSF) += mjpeg2jpeg_bsf.o OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o \ diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index 67bb1fd31a..6b00c9088d 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -34,6 +34,7 @@ #include "idctdsp.h" #include "get_bits.h" #include "internal.h" +#include "jpegtables.h" #include "mjpeg.h" enum ChunkType { diff --git a/libavcodec/mjpeg.c b/libavcodec/jpegtables.c similarity index 99% rename from libavcodec/mjpeg.c rename to libavcodec/jpegtables.c index bdd7b191f5..cbe5523cb4 100644 --- a/libavcodec/mjpeg.c +++ b/libavcodec/jpegtables.c @@ -30,7 +30,7 @@ * MJPEG encoder and decoder. */ -#include "mjpeg.h" +#include "jpegtables.h" #if 0 diff --git a/libavcodec/jpegtables.h b/libavcodec/jpegtables.h new file mode 100644 index 0000000000..6833b4b166 --- /dev/null +++ b/libavcodec/jpegtables.h @@ -0,0 +1,43 @@ +/* + * JPEG-related tables + * + * 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_JPEGTABLES_H +#define AVCODEC_JPEGTABLES_H + +#include + +#include "libavutil/internal.h" + +extern av_export const uint8_t avpriv_mjpeg_bits_dc_luminance[]; +extern av_export const uint8_t avpriv_mjpeg_val_dc[]; + +extern av_export const uint8_t avpriv_mjpeg_bits_dc_chrominance[]; + +extern av_export const uint8_t avpriv_mjpeg_bits_ac_luminance[]; +extern av_export const uint8_t avpriv_mjpeg_val_ac_luminance[]; + +extern av_export const uint8_t avpriv_mjpeg_bits_ac_chrominance[]; +extern av_export 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 */ diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index 1ace31b318..8c0ebf5e08 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -37,6 +37,7 @@ #include "avcodec.h" #include "idctdsp.h" #include "internal.h" +#include "jpegtables.h" #include "mjpegenc_common.h" #include "mpegvideo.h" #include "mjpeg.h" diff --git a/libavcodec/mjpeg.h b/libavcodec/mjpeg.h index 869aebb135..cd5d0af2ac 100644 --- a/libavcodec/mjpeg.h +++ b/libavcodec/mjpeg.h @@ -33,10 +33,6 @@ #ifndef AVCODEC_MJPEG_H #define AVCODEC_MJPEG_H -#include "libavutil/internal.h" - -#include "avcodec.h" - /* JPEG marker codes */ enum JpegMarker { /* start of frame */ @@ -132,19 +128,4 @@ enum JpegMarker { case 7: ret= (left + top)>>1; break;\ } -extern av_export const uint8_t avpriv_mjpeg_bits_dc_luminance[]; -extern av_export const uint8_t avpriv_mjpeg_val_dc[]; - -extern av_export const uint8_t avpriv_mjpeg_bits_dc_chrominance[]; - -extern av_export const uint8_t avpriv_mjpeg_bits_ac_luminance[]; -extern av_export const uint8_t avpriv_mjpeg_val_ac_luminance[]; - -extern av_export const uint8_t avpriv_mjpeg_bits_ac_chrominance[]; -extern av_export 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_MJPEG_H */ diff --git a/libavcodec/mjpeg2jpeg_bsf.c b/libavcodec/mjpeg2jpeg_bsf.c index 6adeaf0ac8..68640db9e6 100644 --- a/libavcodec/mjpeg2jpeg_bsf.c +++ b/libavcodec/mjpeg2jpeg_bsf.c @@ -30,7 +30,7 @@ #include "libavutil/mem.h" #include "avcodec.h" -#include "mjpeg.h" +#include "jpegtables.h" static const uint8_t jpeg_header[] = { 0xff, 0xd8, // SOI diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index fb17993ea0..60348d59b4 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -38,6 +38,7 @@ #include "copy_block.h" #include "idctdsp.h" #include "internal.h" +#include "jpegtables.h" #include "mjpeg.h" #include "mjpegdec.h" #include "jpeglsdec.h" diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index 24f8d1dbfc..2188725e26 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -33,6 +33,7 @@ #include "libavutil/pixdesc.h" #include "avcodec.h" +#include "jpegtables.h" #include "mjpegenc_common.h" #include "mpegvideo.h" #include "mjpeg.h" diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c index de582d31ea..3e3b7cd6ed 100644 --- a/libavcodec/mjpegenc_common.c +++ b/libavcodec/mjpegenc_common.c @@ -29,6 +29,7 @@ #include "avcodec.h" #include "idctdsp.h" +#include "jpegtables.h" #include "put_bits.h" #include "mjpegenc.h" #include "mjpegenc_common.h" diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c index 2028053536..6bf88f8c3a 100644 --- a/libavformat/rtpdec_jpeg.c +++ b/libavformat/rtpdec_jpeg.c @@ -24,6 +24,7 @@ #include "rtpdec.h" #include "rtpdec_formats.h" #include "libavutil/intreadwrite.h" +#include "libavcodec/jpegtables.h" #include "libavcodec/mjpeg.h" #include "libavcodec/bytestream.h"