diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-06-08 03:56:36 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-06-08 05:25:28 +0200 |
commit | d552f616a26623e5b593e4d3474c61563f3939fd (patch) | |
tree | f5f3791b58abe6ea8895709b7d2be272afc493ab /libavcodec | |
parent | 7d89f7cbf3ccd98f9a5f58db97effa9afd2d571a (diff) | |
parent | ac4a8548110bc180cb67bea6eaf8b8e1081370cf (diff) | |
download | ffmpeg-d552f616a26623e5b593e4d3474c61563f3939fd.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (28 commits)
Remove some non-compiling debug messages.
ffplay: Fix non-compiling debug printf and replace it by av_dlog.
H264: x86 predict init cosmetics.
ac3enc: Fix linking of AC-3 encoder without the E-AC-3 encoder.
Move E-AC-3 encoder functions to a separate eac3enc.c file.
ac3enc: remove convenience macro, #define DEBUG
ac3enc: remove unused #define
vc1: re-initialize tables after width/height change.
APIchanges: fill-in git commit hash for av_get_bytes_per_sample() addition
samplefmt: add av_get_bytes_per_sample()
iirfilter: fix biquad filter coefficients.
swscale: remove duplicate conversion routine in swScale().
swscale: add yuv2planar/packed function typedefs.
swscale: integrate yuv2nv12X_C into yuv2yuvX() function pointers.
swscale: reindent x86 init code.
swscale: extract SWS_FULL_CHR_H_INT conditional into init code.
swscale: cosmetics.
swscale: remove alp/chr/lumSrcOffset.
swscale: un-special-case yuv2yuvX16_c().
shorten: Remove stray DEBUG #define and corresponding av_dlog statement.
...
Conflicts:
doc/APIchanges
libavcodec/ac3enc.c
libavutil/avutil.h
libavutil/samplefmt.c
libswscale/swscale.c
libswscale/swscale_internal.h
libswscale/x86/swscale_template.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/Makefile | 3 | ||||
-rw-r--r-- | libavcodec/aac_tablegen.h | 2 | ||||
-rw-r--r-- | libavcodec/ac3.h | 1 | ||||
-rw-r--r-- | libavcodec/ac3enc.c | 257 | ||||
-rw-r--r-- | libavcodec/ac3enc.h | 214 | ||||
-rw-r--r-- | libavcodec/bitstream.c | 26 | ||||
-rw-r--r-- | libavcodec/dnxhdenc.h | 5 | ||||
-rw-r--r-- | libavcodec/dv.c | 28 | ||||
-rw-r--r-- | libavcodec/dvbsub_parser.c | 16 | ||||
-rw-r--r-- | libavcodec/dvbsubdec.c | 48 | ||||
-rw-r--r-- | libavcodec/eac3enc.c | 131 | ||||
-rw-r--r-- | libavcodec/eac3enc.h | 44 | ||||
-rw-r--r-- | libavcodec/iirfilter.c | 2 | ||||
-rw-r--r-- | libavcodec/mlpdsp.c | 2 | ||||
-rw-r--r-- | libavcodec/pgssubdec.c | 13 | ||||
-rw-r--r-- | libavcodec/ppc/h264_template_altivec.c | 3 | ||||
-rw-r--r-- | libavcodec/shorten.c | 2 | ||||
-rw-r--r-- | libavcodec/v210enc.c | 2 | ||||
-rw-r--r-- | libavcodec/vc1dec.c | 19 | ||||
-rw-r--r-- | libavcodec/vorbisdec.c | 4 | ||||
-rw-r--r-- | libavcodec/x86/h264_intrapred_init.c | 220 |
21 files changed, 571 insertions, 471 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 2721423473..e2a4518a7f 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -127,7 +127,8 @@ OBJS-$(CONFIG_DVVIDEO_DECODER) += dv.o dvdata.o OBJS-$(CONFIG_DVVIDEO_ENCODER) += dv.o dvdata.o OBJS-$(CONFIG_DXA_DECODER) += dxa.o OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o eac3dec_data.o -OBJS-$(CONFIG_EAC3_ENCODER) += ac3enc_float.o ac3tab.o ac3.o kbdwin.o +OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o ac3enc_float.o ac3tab.o \ + ac3.o kbdwin.o OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o OBJS-$(CONFIG_EAMAD_DECODER) += eamad.o eaidct.o mpeg12.o \ mpeg12data.o mpegvideo.o \ diff --git a/libavcodec/aac_tablegen.h b/libavcodec/aac_tablegen.h index 0c009ba48e..7afa466139 100644 --- a/libavcodec/aac_tablegen.h +++ b/libavcodec/aac_tablegen.h @@ -29,7 +29,7 @@ #include "libavcodec/aac_tables.h" #else #include "libavutil/mathematics.h" -#include "libavcodec/aac.h" +#include "aac.h" float ff_aac_pow2sf_tab[428]; void ff_aac_tableinit(void) diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h index 47878c39cd..a53817e1b0 100644 --- a/libavcodec/ac3.h +++ b/libavcodec/ac3.h @@ -164,7 +164,6 @@ typedef struct AC3EncOptions { int cpl_start; } AC3EncOptions; - void ff_ac3_common_init(void); extern const int64_t ff_ac3_channel_layouts[]; diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index d210e579d5..4f153191a0 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -26,7 +26,6 @@ * The simplest AC-3 encoder. */ -//#define DEBUG //#define ASSERT_LEVEL 2 #include <stdint.h> @@ -44,153 +43,8 @@ #include "audioconvert.h" #include "fft.h" - -#ifndef CONFIG_AC3ENC_FLOAT -#define CONFIG_AC3ENC_FLOAT 0 -#endif - - -/** Maximum number of exponent groups. +1 for separate DC exponent. */ -#define AC3_MAX_EXP_GROUPS 85 - -#if CONFIG_AC3ENC_FLOAT -#define MAC_COEF(d,a,b) ((d)+=(a)*(b)) -typedef float SampleType; -typedef float CoefType; -typedef float CoefSumType; -#else -#define MAC_COEF(d,a,b) MAC64(d,a,b) -typedef int16_t SampleType; -typedef int32_t CoefType; -typedef int64_t CoefSumType; -#endif - -typedef struct AC3MDCTContext { - const SampleType *window; ///< MDCT window function - FFTContext fft; ///< FFT context for MDCT calculation -} AC3MDCTContext; - - -/** - * Data for a single audio block. - */ -typedef struct AC3Block { - CoefType **mdct_coef; ///< MDCT coefficients - int32_t **fixed_coef; ///< fixed-point MDCT coefficients - uint8_t **exp; ///< original exponents - uint8_t **grouped_exp; ///< grouped exponents - int16_t **psd; ///< psd per frequency bin - int16_t **band_psd; ///< psd per critical band - int16_t **mask; ///< masking curve - uint16_t **qmant; ///< quantized mantissas - uint8_t **cpl_coord_exp; ///< coupling coord exponents (cplcoexp) - uint8_t **cpl_coord_mant; ///< coupling coord mantissas (cplcomant) - uint8_t coeff_shift[AC3_MAX_CHANNELS]; ///< fixed-point coefficient shift values - uint8_t new_rematrixing_strategy; ///< send new rematrixing flags in this block - int num_rematrixing_bands; ///< number of rematrixing bands - uint8_t rematrixing_flags[4]; ///< rematrixing flags - int new_cpl_strategy; ///< send new coupling strategy - int cpl_in_use; ///< coupling in use for this block (cplinu) - uint8_t channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl) - int num_cpl_channels; ///< number of channels in coupling - uint8_t new_cpl_coords; ///< send new coupling coordinates (cplcoe) - uint8_t cpl_master_exp[AC3_MAX_CHANNELS]; ///< coupling coord master exponents (mstrcplco) - int new_snr_offsets; ///< send new SNR offsets - int new_cpl_leak; ///< send new coupling leak info - int end_freq[AC3_MAX_CHANNELS]; ///< end frequency bin (endmant) -} AC3Block; - -/** - * AC-3 encoder private context. - */ -typedef struct AC3EncodeContext { - AVClass *av_class; ///< AVClass used for AVOption - AC3EncOptions options; ///< encoding options - PutBitContext pb; ///< bitstream writer context - DSPContext dsp; - AC3DSPContext ac3dsp; ///< AC-3 optimized functions - AC3MDCTContext mdct; ///< MDCT context - - AC3Block blocks[AC3_MAX_BLOCKS]; ///< per-block info - - int eac3; ///< indicates if this is E-AC-3 vs. AC-3 - int bitstream_id; ///< bitstream id (bsid) - int bitstream_mode; ///< bitstream mode (bsmod) - - int bit_rate; ///< target bit rate, in bits-per-second - int sample_rate; ///< sampling frequency, in Hz - - int frame_size_min; ///< minimum frame size in case rounding is necessary - int frame_size; ///< current frame size in bytes - int frame_size_code; ///< frame size code (frmsizecod) - uint16_t crc_inv[2]; - int64_t bits_written; ///< bit count (used to avg. bitrate) - int64_t samples_written; ///< sample count (used to avg. bitrate) - - int fbw_channels; ///< number of full-bandwidth channels (nfchans) - int channels; ///< total number of channels (nchans) - int lfe_on; ///< indicates if there is an LFE channel (lfeon) - int lfe_channel; ///< channel index of the LFE channel - int has_center; ///< indicates if there is a center channel - int has_surround; ///< indicates if there are one or more surround channels - int channel_mode; ///< channel mode (acmod) - const uint8_t *channel_map; ///< channel map used to reorder channels - - int center_mix_level; ///< center mix level code - int surround_mix_level; ///< surround mix level code - int ltrt_center_mix_level; ///< Lt/Rt center mix level code - int ltrt_surround_mix_level; ///< Lt/Rt surround mix level code - int loro_center_mix_level; ///< Lo/Ro center mix level code - int loro_surround_mix_level; ///< Lo/Ro surround mix level code - - int cutoff; ///< user-specified cutoff frequency, in Hz - int bandwidth_code; ///< bandwidth code (0 to 60) (chbwcod) - int start_freq[AC3_MAX_CHANNELS]; ///< start frequency bin (strtmant) - int cpl_end_freq; ///< coupling channel end frequency bin - - int cpl_on; ///< coupling turned on for this frame - int cpl_enabled; ///< coupling enabled for all frames - int num_cpl_subbands; ///< number of coupling subbands (ncplsubnd) - int num_cpl_bands; ///< number of coupling bands (ncplbnd) - uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]; ///< number of coeffs in each coupling band - - int rematrixing_enabled; ///< stereo rematrixing enabled - - /* bitrate allocation control */ - int slow_gain_code; ///< slow gain code (sgaincod) - int slow_decay_code; ///< slow decay code (sdcycod) - int fast_decay_code; ///< fast decay code (fdcycod) - int db_per_bit_code; ///< dB/bit code (dbpbcod) - int floor_code; ///< floor code (floorcod) - AC3BitAllocParameters bit_alloc; ///< bit allocation parameters - int coarse_snr_offset; ///< coarse SNR offsets (csnroffst) - int fast_gain_code[AC3_MAX_CHANNELS]; ///< fast gain codes (signal-to-mask ratio) (fgaincod) - int fine_snr_offset[AC3_MAX_CHANNELS]; ///< fine SNR offsets (fsnroffst) - int frame_bits_fixed; ///< number of non-coefficient bits for fixed parameters - int frame_bits; ///< all frame bits except exponents and mantissas - int exponent_bits; ///< number of bits used for exponents - - SampleType **planar_samples; - uint8_t *bap_buffer; - uint8_t *bap1_buffer; - CoefType *mdct_coef_buffer; - int32_t *fixed_coef_buffer; - uint8_t *exp_buffer; - uint8_t *grouped_exp_buffer; - int16_t *psd_buffer; - int16_t *band_psd_buffer; - int16_t *mask_buffer; - uint16_t *qmant_buffer; - uint8_t *cpl_coord_exp_buffer; - uint8_t *cpl_coord_mant_buffer; - - uint8_t exp_strategy[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< exponent strategies - uint8_t exp_ref_block[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< reference blocks for EXP_REUSE - uint8_t *ref_bap [AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< bit allocation pointers (bap) - int ref_bap_set; ///< indicates if ref_bap pointers have been set - - DECLARE_ALIGNED(32, SampleType, windowed_samples)[AC3_WINDOW_SIZE]; -} AC3EncodeContext; +#include "ac3enc.h" +#include "eac3enc.h" typedef struct AC3Mant { uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; ///< mantissa pointers for bap=1,2,4 @@ -715,34 +569,8 @@ static void apply_channel_coupling(AC3EncodeContext *s) } } - if (s->eac3) { - /* set first cpl coords */ - int first_cpl_coords[AC3_MAX_CHANNELS]; - for (ch = 1; ch <= s->fbw_channels; ch++) - first_cpl_coords[ch] = 1; - for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { - AC3Block *block = &s->blocks[blk]; - for (ch = 1; ch <= s->fbw_channels; ch++) { - if (block->channel_in_cpl[ch]) { - if (first_cpl_coords[ch]) { - block->new_cpl_coords = 2; - first_cpl_coords[ch] = 0; - } - } else { - first_cpl_coords[ch] = 1; - } - } - } - - /* set first cpl leak */ - for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { - AC3Block *block = &s->blocks[blk]; - if (block->cpl_in_use) { - block->new_cpl_leak = 2; - break; - } - } - } + if (CONFIG_EAC3_ENCODER && s->eac3) + ff_eac3_set_cpl_states(s); #endif /* CONFIG_AC3ENC_FLOAT */ } @@ -1880,79 +1708,6 @@ static void ac3_output_frame_header(AC3EncodeContext *s) /** - * Write the E-AC-3 frame header to the output bitstream. - */ -static void eac3_output_frame_header(AC3EncodeContext *s) -{ - int blk, ch; - AC3EncOptions *opt = &s->options; - - put_bits(&s->pb, 16, 0x0b77); /* sync word */ - - /* BSI header */ - put_bits(&s->pb, 2, 0); /* stream type = independent */ - put_bits(&s->pb, 3, 0); /* substream id = 0 */ - put_bits(&s->pb, 11, (s->frame_size / 2) - 1); /* frame size */ - if (s->bit_alloc.sr_shift) { - put_bits(&s->pb, 2, 0x3); /* fscod2 */ - put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */ - } else { - put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */ - put_bits(&s->pb, 2, 0x3); /* number of blocks = 6 */ - } - put_bits(&s->pb, 3, s->channel_mode); /* audio coding mode */ - put_bits(&s->pb, 1, s->lfe_on); /* LFE channel indicator */ - put_bits(&s->pb, 5, s->bitstream_id); /* bitstream id (EAC3=16) */ - put_bits(&s->pb, 5, -opt->dialogue_level); /* dialogue normalization level */ - put_bits(&s->pb, 1, 0); /* no compression gain */ - put_bits(&s->pb, 1, 0); /* no mixing metadata */ - /* TODO: mixing metadata */ - put_bits(&s->pb, 1, 0); /* no info metadata */ - /* TODO: info metadata */ - put_bits(&s->pb, 1, 0); /* no additional bit stream info */ - - /* frame header */ - put_bits(&s->pb, 1, 1); /* exponent strategy syntax = each block */ - put_bits(&s->pb, 1, 0); /* aht enabled = no */ - put_bits(&s->pb, 2, 0); /* snr offset strategy = 1 */ - put_bits(&s->pb, 1, 0); /* transient pre-noise processing enabled = no */ - put_bits(&s->pb, 1, 0); /* block switch syntax enabled = no */ - put_bits(&s->pb, 1, 0); /* dither flag syntax enabled = no */ - put_bits(&s->pb, 1, 0); /* bit allocation model syntax enabled = no */ - put_bits(&s->pb, 1, 0); /* fast gain codes enabled = no */ - put_bits(&s->pb, 1, 0); /* dba syntax enabled = no */ - put_bits(&s->pb, 1, 0); /* skip field syntax enabled = no */ - put_bits(&s->pb, 1, 0); /* spx enabled = no */ - /* coupling strategy use flags */ - if (s->channel_mode > AC3_CHMODE_MONO) { - put_bits(&s->pb, 1, s->blocks[0].cpl_in_use); - for (blk = 1; blk < AC3_MAX_BLOCKS; blk++) { - AC3Block *block = &s->blocks[blk]; - put_bits(&s->pb, 1, block->new_cpl_strategy); - if (block->new_cpl_strategy) - put_bits(&s->pb, 1, block->cpl_in_use); - } - } - /* exponent strategy */ - for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) - for (ch = !s->blocks[blk].cpl_in_use; ch <= s->fbw_channels; ch++) - put_bits(&s->pb, 2, s->exp_strategy[ch][blk]); - if (s->lfe_on) { - for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) - put_bits(&s->pb, 1, s->exp_strategy[s->lfe_channel][blk]); - } - /* E-AC-3 to AC-3 converter exponent strategy (unfortunately not optional...) */ - for (ch = 1; ch <= s->fbw_channels; ch++) - put_bits(&s->pb, 5, 0); - /* snr offsets */ - put_bits(&s->pb, 6, s->coarse_snr_offset); - put_bits(&s->pb, 4, s->fine_snr_offset[1]); - /* block start info */ - put_bits(&s->pb, 1, 0); -} - - -/** * Write one audio block to the output bitstream. */ static void output_audio_block(AC3EncodeContext *s, int blk) @@ -2235,8 +1990,8 @@ static void output_frame(AC3EncodeContext *s, unsigned char *frame) init_put_bits(&s->pb, frame, AC3_MAX_CODED_FRAME_SIZE); - if (s->eac3) - eac3_output_frame_header(s); + if (CONFIG_EAC3_ENCODER && s->eac3) + ff_eac3_output_frame_header(s); else ac3_output_frame_header(s); diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h new file mode 100644 index 0000000000..d1f5548297 --- /dev/null +++ b/libavcodec/ac3enc.h @@ -0,0 +1,214 @@ +/* + * AC-3 encoder & E-AC-3 encoder common header + * Copyright (c) 2000 Fabrice Bellard + * Copyright (c) 2006-2010 Justin Ruggles <justin.ruggles@gmail.com> + * + * This file is part of Libav. + * + * Libav 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. + * + * Libav 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 Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * AC-3 encoder & E-AC-3 encoder common header + */ + +#ifndef AVCODEC_AC3ENC_H +#define AVCODEC_AC3ENC_H + +#include <stdint.h> +#include "ac3.h" +#include "ac3dsp.h" +#include "avcodec.h" +#include "dsputil.h" +#include "put_bits.h" +#include "fft.h" + +#ifndef CONFIG_AC3ENC_FLOAT +#define CONFIG_AC3ENC_FLOAT 0 +#endif + +#if CONFIG_AC3ENC_FLOAT +#define MAC_COEF(d,a,b) ((d)+=(a)*(b)) +typedef float SampleType; +typedef float CoefType; +typedef float CoefSumType; +#else +#define MAC_COEF(d,a,b) MAC64(d,a,b) +typedef int16_t SampleType; +typedef int32_t CoefType; +typedef int64_t CoefSumType; +#endif + +typedef struct AC3MDCTContext { + const SampleType *window; ///< MDCT window function + FFTContext fft; ///< FFT context for MDCT calculation +} AC3MDCTContext; +#if 0 +/** + * Encoding Options used by AVOption. + */ +typedef struct AC3EncOptions { + /* AC-3 metadata options*/ + int dialogue_level; + int bitstream_mode; + float center_mix_level; + float surround_mix_level; + int dolby_surround_mode; + int audio_production_info; + int mixing_level; + int room_type; + int copyright; + int original; + int extended_bsi_1; + int preferred_stereo_downmix; + float ltrt_center_mix_level; + float ltrt_surround_mix_level; + float loro_center_mix_level; + float loro_surround_mix_level; + int extended_bsi_2; + int dolby_surround_ex_mode; + int dolby_headphone_mode; + int ad_converter_type; + + /* other encoding options */ + int allow_per_frame_metadata; + int stereo_rematrixing; + int channel_coupling; + int cpl_start; +} AC3EncOptions; +#endif +/** + * Data for a single audio block. + */ +typedef struct AC3Block { + CoefType **mdct_coef; ///< MDCT coefficients + int32_t **fixed_coef; ///< fixed-point MDCT coefficients + uint8_t **exp; ///< original exponents + uint8_t **grouped_exp; ///< grouped exponents + int16_t **psd; ///< psd per frequency bin + int16_t **band_psd; ///< psd per critical band + int16_t **mask; ///< masking curve + uint16_t **qmant; ///< quantized mantissas + uint8_t **cpl_coord_exp; ///< coupling coord exponents (cplcoexp) + uint8_t **cpl_coord_mant; ///< coupling coord mantissas (cplcomant) + uint8_t coeff_shift[AC3_MAX_CHANNELS]; ///< fixed-point coefficient shift values + uint8_t new_rematrixing_strategy; ///< send new rematrixing flags in this block + int num_rematrixing_bands; ///< number of rematrixing bands + uint8_t rematrixing_flags[4]; ///< rematrixing flags + int new_cpl_strategy; ///< send new coupling strategy + int cpl_in_use; ///< coupling in use for this block (cplinu) + uint8_t channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl) + int num_cpl_channels; ///< number of channels in coupling + uint8_t new_cpl_coords; ///< send new coupling coordinates (cplcoe) + uint8_t cpl_master_exp[AC3_MAX_CHANNELS]; ///< coupling coord master exponents (mstrcplco) + int new_snr_offsets; ///< send new SNR offsets + int new_cpl_leak; ///< send new coupling leak info + int end_freq[AC3_MAX_CHANNELS]; ///< end frequency bin (endmant) +} AC3Block; + +/** + * AC-3 encoder private context. + */ +typedef struct AC3EncodeContext { + AVClass *av_class; ///< AVClass used for AVOption + AC3EncOptions options; ///< encoding options + PutBitContext pb; ///< bitstream writer context + DSPContext dsp; + AC3DSPContext ac3dsp; ///< AC-3 optimized functions + AC3MDCTContext mdct; ///< MDCT context + + AC3Block blocks[AC3_MAX_BLOCKS]; ///< per-block info + + int eac3; ///< indicates if this is E-AC-3 vs. AC-3 + int bitstream_id; ///< bitstream id (bsid) + int bitstream_mode; ///< bitstream mode (bsmod) + + int bit_rate; ///< target bit rate, in bits-per-second + int sample_rate; ///< sampling frequency, in Hz + + int frame_size_min; ///< minimum frame size in case rounding is necessary + int frame_size; ///< current frame size in bytes + int frame_size_code; ///< frame size code (frmsizecod) + uint16_t crc_inv[2]; + int64_t bits_written; ///< bit count (used to avg. bitrate) + int64_t samples_written; ///< sample count (used to avg. bitrate) + + int fbw_channels; ///< number of full-bandwidth channels (nfchans) + int channels; ///< total number of channels (nchans) + int lfe_on; ///< indicates if there is an LFE channel (lfeon) + int lfe_channel; ///< channel index of the LFE channel + int has_center; ///< indicates if there is a center channel + int has_surround; ///< indicates if there are one or more surround channels + int channel_mode; ///< channel mode (acmod) + const uint8_t *channel_map; ///< channel map used to reorder channels + + int center_mix_level; ///< center mix level code + int surround_mix_level; ///< surround mix level code + int ltrt_center_mix_level; ///< Lt/Rt center mix level code + int ltrt_surround_mix_level; ///< Lt/Rt surround mix level code + int loro_center_mix_level; ///< Lo/Ro center mix level code + int loro_surround_mix_level; ///< Lo/Ro surround mix level code + + int cutoff; ///< user-specified cutoff frequency, in Hz + int bandwidth_code; ///< bandwidth code (0 to 60) (chbwcod) + int start_freq[AC3_MAX_CHANNELS]; ///< start frequency bin (strtmant) + int cpl_end_freq; ///< coupling channel end frequency bin + + int cpl_on; ///< coupling turned on for this frame + int cpl_enabled; ///< coupling enabled for all frames + int num_cpl_subbands; ///< number of coupling subbands (ncplsubnd) + int num_cpl_bands; ///< number of coupling bands (ncplbnd) + uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]; ///< number of coeffs in each coupling band + + int rematrixing_enabled; ///< stereo rematrixing enabled + + /* bitrate allocation control */ + int slow_gain_code; ///< slow gain code (sgaincod) + int slow_decay_code; ///< slow decay code (sdcycod) + int fast_decay_code; ///< fast decay code (fdcycod) + int db_per_bit_code; ///< dB/bit code (dbpbcod) + int floor_code; ///< floor code (floorcod) + AC3BitAllocParameters bit_alloc; ///< bit allocation parameters + int coarse_snr_offset; ///< coarse SNR offsets (csnroffst) + int fast_gain_code[AC3_MAX_CHANNELS]; ///< fast gain codes (signal-to-mask ratio) (fgaincod) + int fine_snr_offset[AC3_MAX_CHANNELS]; ///< fine SNR offsets (fsnroffst) + int frame_bits_fixed; ///< number of non-coefficient bits for fixed parameters + int frame_bits; ///< all frame bits except exponents and mantissas + int exponent_bits; ///< number of bits used for exponents + + SampleType **planar_samples; + uint8_t *bap_buffer; + uint8_t *bap1_buffer; + CoefType *mdct_coef_buffer; + int32_t *fixed_coef_buffer; + uint8_t *exp_buffer; + uint8_t *grouped_exp_buffer; + int16_t *psd_buffer; + int16_t *band_psd_buffer; + int16_t *mask_buffer; + uint16_t *qmant_buffer; + uint8_t *cpl_coord_exp_buffer; + uint8_t *cpl_coord_mant_buffer; + + uint8_t exp_strategy[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< exponent strategies + uint8_t exp_ref_block[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< reference blocks for EXP_REUSE + uint8_t *ref_bap [AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< bit allocation pointers (bap) + int ref_bap_set; ///< indicates if ref_bap pointers have been set + + DECLARE_ALIGNED(32, SampleType, windowed_samples)[AC3_WINDOW_SIZE]; +} AC3EncodeContext; + +#endif /* AVCODEC_AC3ENC_H */ diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c index 8fd44e3d78..0b061f0bb8 100644 --- a/libavcodec/bitstream.c +++ b/libavcodec/bitstream.c @@ -83,8 +83,6 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length) /* VLC decoding */ -//#define DEBUG_VLC - #define GET_DATA(v, table, i, wrap, size) \ {\ const uint8_t *ptr = (const uint8_t *)table + i * wrap;\ @@ -164,10 +162,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, table_size = 1 << table_nb_bits; table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC); -#ifdef DEBUG_VLC - av_log(NULL,AV_LOG_DEBUG,"new table index=%d size=%d\n", - table_index, table_size); -#endif + av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); if (table_index < 0) return -1; table = &vlc->table[table_index]; @@ -182,9 +177,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, n = codes[i].bits; code = codes[i].code; symbol = codes[i].symbol; -#if defined(DEBUG_VLC) && 0 - av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code); -#endif + av_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code); if (n <= table_nb_bits) { /* no need to add another table */ j = code >> (32 - table_nb_bits); @@ -195,10 +188,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, inc = 1 << n; } for (k = 0; k < nb; k++) { -#ifdef DEBUG_VLC - av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n", - j, i, n); -#endif + av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n); if (table[j][1] /*bits*/ != 0) { av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); return -1; @@ -228,10 +218,8 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, subtable_bits = FFMIN(subtable_bits, table_nb_bits); j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix; table[j][1] = -subtable_bits; -#ifdef DEBUG_VLC - av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n", - j, codes[i].bits + table_nb_bits); -#endif + av_dlog(NULL, "%4x: n=%d (subtable)\n", + j, codes[i].bits + table_nb_bits); index = build_table(vlc, subtable_bits, k-i, codes+i, flags); if (index < 0) return -1; @@ -293,9 +281,7 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, vlc->table_size = 0; } -#ifdef DEBUG_VLC - av_log(NULL,AV_LOG_DEBUG,"build table nb_codes=%d\n", nb_codes); -#endif + av_dlog(NULL, "build table nb_codes=%d\n", nb_codes); buf = av_malloc((nb_codes+1)*sizeof(VLCcode)); diff --git a/libavcodec/dnxhdenc.h b/libavcodec/dnxhdenc.h index d2251d5b36..a968ae0223 100644 --- a/libavcodec/dnxhdenc.h +++ b/libavcodec/dnxhdenc.h @@ -25,8 +25,9 @@ #define AVCODEC_DNXHDENC_H #include <stdint.h> -#include "libavcodec/mpegvideo.h" -#include "libavcodec/dnxhddata.h" + +#include "mpegvideo.h" +#include "dnxhddata.h" typedef struct { uint16_t mb; diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 6cccaee438..d6c49c86cb 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -358,9 +358,6 @@ static av_cold int dvvideo_init_encoder(AVCodecContext *avctx) return dvvideo_init(avctx); } -// #define VLC_DEBUG -// #define printf(...) av_log(NULL, AV_LOG_ERROR, __VA_ARGS__) - typedef struct BlockInfo { const uint32_t *factor_table; const uint8_t *scan_table; @@ -404,9 +401,8 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) /* get the AC coefficients until last_index is reached */ for (;;) { -#ifdef VLC_DEBUG - printf("%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16), re_index); -#endif + av_dlog(NULL, "%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16), + re_index); /* our own optimized GET_RL_VLC */ index = NEG_USR32(re_cache, TEX_VLC_BITS); vlc_len = dv_rl_vlc[index].len; @@ -427,9 +423,7 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) } re_index += vlc_len; -#ifdef VLC_DEBUG - printf("run=%d level=%d\n", run, level); -#endif + av_dlog(NULL, "run=%d level=%d\n", run, level); pos += run; if (pos >= 64) break; @@ -533,9 +527,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) mb->pos = 0; mb->partial_bit_count = 0; -#ifdef VLC_DEBUG - printf("MB block: %d, %d ", mb_index, j); -#endif + av_dlog(avctx, "MB block: %d, %d ", mb_index, j); dv_decode_ac(&gb, mb, block); /* write the remaining bits in a new buffer only if the @@ -548,9 +540,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) } /* pass 2 : we can do it just after */ -#ifdef VLC_DEBUG - printf("***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index); -#endif + av_dlog(avctx, "***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index); block = block1; mb = mb1; init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb)); @@ -570,9 +560,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) } /* we need a pass other the whole video segment */ -#ifdef VLC_DEBUG - printf("***pass 3 size=%d\n", put_bits_count(&vs_pb)); -#endif + av_dlog(avctx, "***pass 3 size=%d\n", put_bits_count(&vs_pb)); block = &sblock[0][0]; mb = mb_data; init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb)); @@ -580,9 +568,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) for (mb_index = 0; mb_index < 5; mb_index++) { for (j = 0; j < s->sys->bpm; j++) { if (mb->pos < 64) { -#ifdef VLC_DEBUG - printf("start %d:%d\n", mb_index, j); -#endif + av_dlog(avctx, "start %d:%d\n", mb_index, j); dv_decode_ac(&gb, mb, block); } if (mb->pos >= 64 && mb->pos < 127) diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c index 6ecd44af13..59d03d1d46 100644 --- a/libavcodec/dvbsub_parser.c +++ b/libavcodec/dvbsub_parser.c @@ -22,9 +22,6 @@ #include "dsputil.h" #include "get_bits.h" -//#define DEBUG -//#define DEBUG_PACKET_CONTENTS - /* Parser (mostly) copied from dvdsub.c */ #define PARSE_BUF_SIZE (65536) @@ -53,25 +50,20 @@ static int dvbsub_parse(AVCodecParserContext *s, { DVBSubParseContext *pc = s->priv_data; uint8_t *p, *p_end; - int len, buf_pos = 0; + int i, len, buf_pos = 0; av_dlog(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n", s->pts, s->last_pts, s->cur_frame_pts[s->cur_frame_start_index]); -#ifdef DEBUG_PACKET_CONTENTS - int i; - for (i=0; i < buf_size; i++) { - av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); + av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) - av_log(avctx, AV_LOG_INFO, "\n"); + av_dlog(avctx, "\n"); } if (i % 16 != 0) - av_log(avctx, AV_LOG_INFO, "\n"); - -#endif + av_dlog(avctx, "\n"); *poutbuf = NULL; *poutbuf_size = 0; diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index cd2b53decf..d6acd5646e 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -24,10 +24,6 @@ #include "bytestream.h" #include "libavutil/colorspace.h" -//#define DEBUG -//#define DEBUG_PACKET_CONTENTS -//#define DEBUG_SAVE_IMAGES - #define DVBSUB_PAGE_SEGMENT 0x10 #define DVBSUB_REGION_SEGMENT 0x11 #define DVBSUB_CLUT_SEGMENT 0x12 @@ -37,7 +33,7 @@ #define cm (ff_cropTbl + MAX_NEG_CROP) -#ifdef DEBUG_SAVE_IMAGES +#ifdef DEBUG #undef fprintf #if 0 static void png_save(const char *filename, uint8_t *bitmap, int w, int h, @@ -768,20 +764,17 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis av_dlog(avctx, "DVB pixel block size %d, %s field:\n", buf_size, top_bottom ? "bottom" : "top"); -#ifdef DEBUG_PACKET_CONTENTS for (i = 0; i < buf_size; i++) { if (i % 16 == 0) - av_log(avctx, AV_LOG_INFO, "0x%08p: ", buf+i); + av_dlog(avctx, "0x%8p: ", buf+i); - av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); + av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) - av_log(avctx, AV_LOG_INFO, "\n"); + av_dlog(avctx, "\n"); } if (i % 16) - av_log(avctx, AV_LOG_INFO, "\n"); - -#endif + av_dlog(avctx, "\n"); if (region == 0) return; @@ -930,27 +923,22 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx, DVBSubContext *ctx = avctx->priv_data; const uint8_t *buf_end = buf + buf_size; - int clut_id; + int i, clut_id; DVBSubCLUT *clut; int entry_id, depth , full_range; int y, cr, cb, alpha; int r, g, b, r_add, g_add, b_add; -#ifdef DEBUG_PACKET_CONTENTS - int i; - - av_log(avctx, AV_LOG_INFO, "DVB clut packet:\n"); + av_dlog(avctx, "DVB clut packet:\n"); for (i=0; i < buf_size; i++) { - av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); + av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) - av_log(avctx, AV_LOG_INFO, "\n"); + av_dlog(avctx, "\n"); } if (i % 16) - av_log(avctx, AV_LOG_INFO, "\n"); - -#endif + av_dlog(avctx, "\n"); clut_id = *buf++; buf += 1; @@ -1194,7 +1182,7 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx, } -#ifdef DEBUG_SAVE_IMAGES +#ifdef DEBUG static void save_display_set(DVBSubContext *ctx) { DVBSubRegion *region; @@ -1404,7 +1392,7 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, sub->num_rects = i; -#ifdef DEBUG_SAVE_IMAGES +#ifdef DEBUG save_display_set(ctx); #endif @@ -1423,22 +1411,18 @@ static int dvbsub_decode(AVCodecContext *avctx, int segment_type; int page_id; int segment_length; - -#ifdef DEBUG_PACKET_CONTENTS int i; - av_log(avctx, AV_LOG_INFO, "DVB sub packet:\n"); + av_dlog(avctx, "DVB sub packet:\n"); for (i=0; i < buf_size; i++) { - av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); + av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) - av_log(avctx, AV_LOG_INFO, "\n"); + av_dlog(avctx, "\n"); } if (i % 16) - av_log(avctx, AV_LOG_INFO, "\n"); - -#endif + av_dlog(avctx, "\n"); if (buf_size <= 6 || *buf != 0x0f) { av_dlog(avctx, "incomplete or broken packet"); diff --git a/libavcodec/eac3enc.c b/libavcodec/eac3enc.c new file mode 100644 index 0000000000..20f4b879c6 --- /dev/null +++ b/libavcodec/eac3enc.c @@ -0,0 +1,131 @@ +/* + * E-AC-3 encoder + * Copyright (c) 2011 Justin Ruggles <justin.ruggles@gmail.com> + * + * This file is part of Libav. + * + * Libav 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. + * + * Libav 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 Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * E-AC-3 encoder + */ + +#define CONFIG_AC3ENC_FLOAT 1 +#include "ac3enc.h" +#include "eac3enc.h" + +void ff_eac3_set_cpl_states(AC3EncodeContext *s) +{ + int ch, blk; + int first_cpl_coords[AC3_MAX_CHANNELS]; + + /* set first cpl coords */ + for (ch = 1; ch <= s->fbw_channels; ch++) + first_cpl_coords[ch] = 1; + for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { + AC3Block *block = &s->blocks[blk]; + for (ch = 1; ch <= s->fbw_channels; ch++) { + if (block->channel_in_cpl[ch]) { + if (first_cpl_coords[ch]) { + block->new_cpl_coords = 2; + first_cpl_coords[ch] = 0; + } + } else { + first_cpl_coords[ch] = 1; + } + } + } + + /* set first cpl leak */ + for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { + AC3Block *block = &s->blocks[blk]; + if (block->cpl_in_use) { + block->new_cpl_leak = 2; + break; + } + } +} + + +void ff_eac3_output_frame_header(AC3EncodeContext *s) +{ + int blk, ch; + AC3EncOptions *opt = &s->options; + + put_bits(&s->pb, 16, 0x0b77); /* sync word */ + + /* BSI header */ + put_bits(&s->pb, 2, 0); /* stream type = independent */ + put_bits(&s->pb, 3, 0); /* substream id = 0 */ + put_bits(&s->pb, 11, (s->frame_size / 2) - 1); /* frame size */ + if (s->bit_alloc.sr_shift) { + put_bits(&s->pb, 2, 0x3); /* fscod2 */ + put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */ + } else { + put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */ + put_bits(&s->pb, 2, 0x3); /* number of blocks = 6 */ + } + put_bits(&s->pb, 3, s->channel_mode); /* audio coding mode */ + put_bits(&s->pb, 1, s->lfe_on); /* LFE channel indicator */ + put_bits(&s->pb, 5, s->bitstream_id); /* bitstream id (EAC3=16) */ + put_bits(&s->pb, 5, -opt->dialogue_level); /* dialogue normalization level */ + put_bits(&s->pb, 1, 0); /* no compression gain */ + put_bits(&s->pb, 1, 0); /* no mixing metadata */ + /* TODO: mixing metadata */ + put_bits(&s->pb, 1, 0); /* no info metadata */ + /* TODO: info metadata */ + put_bits(&s->pb, 1, 0); /* no additional bit stream info */ + + /* frame header */ + put_bits(&s->pb, 1, 1); /* exponent strategy syntax = each block */ + put_bits(&s->pb, 1, 0); /* aht enabled = no */ + put_bits(&s->pb, 2, 0); /* snr offset strategy = 1 */ + put_bits(&s->pb, 1, 0); /* transient pre-noise processing enabled = no */ + put_bits(&s->pb, 1, 0); /* block switch syntax enabled = no */ + put_bits(&s->pb, 1, 0); /* dither flag syntax enabled = no */ + put_bits(&s->pb, 1, 0); /* bit allocation model syntax enabled = no */ + put_bits(&s->pb, 1, 0); /* fast gain codes enabled = no */ + put_bits(&s->pb, 1, 0); /* dba syntax enabled = no */ + put_bits(&s->pb, 1, 0); /* skip field syntax enabled = no */ + put_bits(&s->pb, 1, 0); /* spx enabled = no */ + /* coupling strategy use flags */ + if (s->channel_mode > AC3_CHMODE_MONO) { + put_bits(&s->pb, 1, s->blocks[0].cpl_in_use); + for (blk = 1; blk < AC3_MAX_BLOCKS; blk++) { + AC3Block *block = &s->blocks[blk]; + put_bits(&s->pb, 1, block->new_cpl_strategy); + if (block->new_cpl_strategy) + put_bits(&s->pb, 1, block->cpl_in_use); + } + } + /* exponent strategy */ + for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) + for (ch = !s->blocks[blk].cpl_in_use; ch <= s->fbw_channels; ch++) + put_bits(&s->pb, 2, s->exp_strategy[ch][blk]); + if (s->lfe_on) { + for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) + put_bits(&s->pb, 1, s->exp_strategy[s->lfe_channel][blk]); + } + /* E-AC-3 to AC-3 converter exponent strategy (unfortunately not optional...) */ + for (ch = 1; ch <= s->fbw_channels; ch++) + put_bits(&s->pb, 5, 0); + /* snr offsets */ + put_bits(&s->pb, 6, s->coarse_snr_offset); + put_bits(&s->pb, 4, s->fine_snr_offset[1]); + /* block start info */ + put_bits(&s->pb, 1, 0); +} diff --git a/libavcodec/eac3enc.h b/libavcodec/eac3enc.h new file mode 100644 index 0000000000..eacb8cf164 --- /dev/null +++ b/libavcodec/eac3enc.h @@ -0,0 +1,44 @@ +/* + * E-AC-3 encoder + * Copyright (c) 2011 Justin Ruggles <justin.ruggles@gmail.com> + * + * This file is part of Libav. + * + * Libav 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. + * + * Libav 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 Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * E-AC-3 encoder + */ + +#ifndef AVCODEC_EAC3ENC_H +#define AVCODEC_EAC3ENC_H + +#include "ac3enc.h" + +/** + * Set coupling states. + * This determines whether certain flags must be written to the bitstream or + * whether they will be implicitly already known by the decoder. + */ +void ff_eac3_set_cpl_states(AC3EncodeContext *s); + +/** + * Write the E-AC-3 frame header to the output bitstream. + */ +void ff_eac3_output_frame_header(AC3EncodeContext *s); + +#endif /* AVCODEC_EAC3ENC_H */ diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index 27461fb389..4b9aae2a5d 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -151,8 +151,6 @@ static int biquad_init_coeffs(void *avc, struct FFIIRFilterCoeffs *c, // during filtering, the delay state will include the gain multiplication c->cx[0] = lrintf(x0 / c->gain); c->cx[1] = lrintf(x1 / c->gain); - c->cy[0] /= c->gain; - c->cy[1] /= c->gain; return 0; } diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c index a0647eee69..7ec8dd24e6 100644 --- a/libavcodec/mlpdsp.c +++ b/libavcodec/mlpdsp.c @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcodec/mlp.h" #include "dsputil.h" +#include "mlp.h" static void ff_mlp_filter_channel(int32_t *state, const int32_t *coeff, int firorder, int iirorder, diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index a91cfe7bf6..315dbbd779 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -30,8 +30,6 @@ #include "libavutil/colorspace.h" #include "libavutil/imgutils.h" -//#define DEBUG_PACKET_CONTENTS - #define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) enum SegmentType { @@ -403,21 +401,18 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf_end; uint8_t segment_type; int segment_length; - -#ifdef DEBUG_PACKET_CONTENTS int i; - av_log(avctx, AV_LOG_INFO, "PGS sub packet:\n"); + av_dlog(avctx, "PGS sub packet:\n"); for (i = 0; i < buf_size; i++) { - av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); + av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) - av_log(avctx, AV_LOG_INFO, "\n"); + av_dlog(avctx, "\n"); } if (i & 15) - av_log(avctx, AV_LOG_INFO, "\n"); -#endif + av_dlog(avctx, "\n"); *data_size = 0; diff --git a/libavcodec/ppc/h264_template_altivec.c b/libavcodec/ppc/h264_template_altivec.c index 29e4d40d4f..2573e9c6f7 100644 --- a/libavcodec/ppc/h264_template_altivec.c +++ b/libavcodec/ppc/h264_template_altivec.c @@ -18,8 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -//#define DEBUG_ALIGNMENT -#ifdef DEBUG_ALIGNMENT +#ifdef DEBUG #define ASSERT_ALIGNED(ptr) assert(((unsigned long)ptr&0x0000000F)); #else #define ASSERT_ALIGNED(ptr) ; diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 734ea63785..f593d0a164 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -26,7 +26,6 @@ * */ -#define DEBUG #include <limits.h> #include "avcodec.h" #include "get_bits.h" @@ -304,7 +303,6 @@ static int shorten_decode_frame(AVCodecContext *avctx, s->bitstream_size= buf_size; if(buf_size < s->max_framesize){ - //av_dlog(avctx, "wanna more data ... %d\n", buf_size); *data_size = 0; return input_buf_size; } diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c index d1b3d9f858..fd47d7a5e7 100644 --- a/libavcodec/v210enc.c +++ b/libavcodec/v210enc.c @@ -22,7 +22,7 @@ */ #include "avcodec.h" -#include "libavcodec/bytestream.h" +#include "bytestream.h" static av_cold int encode_init(AVCodecContext *avctx) { diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index d35e664aca..852c874ee1 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -3398,7 +3398,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; GetBitContext gb; - int i; + int i, cur_width, cur_height; if (!avctx->extradata_size || !avctx->extradata) return -1; if (!(avctx->flags & CODEC_FLAG_GRAY)) @@ -3419,8 +3419,8 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) if (vc1_init_common(v) < 0) return -1; ff_vc1dsp_init(&v->vc1dsp); - avctx->coded_width = avctx->width; - avctx->coded_height = avctx->height; + cur_width = avctx->coded_width = avctx->width; + cur_height = avctx->coded_height = avctx->height; if (avctx->codec_id == CODEC_ID_WMV3) { int count = 0; @@ -3491,6 +3491,19 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) } v->res_sprite = (avctx->codec_tag == MKTAG('W','V','P','2')); } + // Sequence header information may not have been parsed + // yet when ff_msmpeg4_decode_init was called the fist time + // above. If sequence information changes, we need to call + // it again. + if (cur_width != avctx->width || + cur_height != avctx->height) { + MPV_common_end(s); + if(ff_msmpeg4_decode_init(avctx) < 0) + return -1; + avctx->coded_width = avctx->width; + avctx->coded_height = avctx->height; + } + avctx->profile = v->profile; if (v->profile == PROFILE_ADVANCED) avctx->level = v->level; diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index 73a9b41145..e012f611a9 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <inttypes.h> #include <math.h> #define ALT_BITSTREAM_READER_LE @@ -1089,6 +1090,9 @@ static int vorbis_floor0_decode(vorbis_context *vc, for (i = 0; i < order; i++) lsp[i] = 2.0f * cos(lsp[i]); + av_dlog(NULL, "floor0 synth: map_size = %"PRIu32"; m = %d; wstep = %f\n", + vf->map_size[blockflag], order, wstep); + i = 0; while (i < vf->map_size[blockflag]) { int j, iter_cond = vf->map[blockflag][i]; diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c index 878f956f88..d71f71e861 100644 --- a/libavcodec/x86/h264_intrapred_init.c +++ b/libavcodec/x86/h264_intrapred_init.c @@ -124,132 +124,132 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth { int mm_flags = av_get_cpu_flags(); - if (bit_depth == 8) { #if HAVE_YASM - if (mm_flags & AV_CPU_FLAG_MMX) { - h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_mmx; - h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx; - h->pred8x8 [VERT_PRED8x8] = ff_pred8x8_vertical_mmx; - h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx; - if (codec_id == CODEC_ID_VP8) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmx; - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_mmx; - h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx; - } else { - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx; - if (codec_id == CODEC_ID_SVQ3) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx; - } else if (codec_id == CODEC_ID_RV40) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx; + if (bit_depth == 8) { + if (mm_flags & AV_CPU_FLAG_MMX) { + h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_mmx; + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx; + h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_mmx; + h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx; + if (codec_id == CODEC_ID_VP8) { + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx; + h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx; + h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx; } else { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx; + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx; + if (codec_id == CODEC_ID_SVQ3) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx; + } else if (codec_id == CODEC_ID_RV40) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx; + } else { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx; + } } } - } - if (mm_flags & AV_CPU_FLAG_MMX2) { - h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext; - h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmxext; - h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext; - h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext; - h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_mmxext; - h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_mmxext; - h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_mmxext; - h->pred8x8l [DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_mmxext; - h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_mmxext; - h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_mmxext; - h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_mmxext; - h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_mmxext; - h->pred4x4 [DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_mmxext; - h->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_mmxext; - h->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_mmxext; - h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext; - if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264) - h->pred4x4 [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext; - if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264) - h->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_mmxext; - if (codec_id != CODEC_ID_RV40) { - h->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_mmxext; - } - if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264) { - h->pred8x8 [TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext; - h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_mmxext; - } - if (codec_id == CODEC_ID_VP8) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmxext; - h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext; - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_mmxext; - h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmxext; - h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext; - } else { - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx2; - if (codec_id == CODEC_ID_SVQ3) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx2; - } else if (codec_id == CODEC_ID_RV40) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx2; + if (mm_flags & AV_CPU_FLAG_MMX2) { + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext; + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmxext; + h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext; + h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext; + h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_mmxext; + h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_mmxext; + h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_mmxext; + h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_mmxext; + h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_mmxext; + h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_mmxext; + h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_mmxext; + h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_mmxext; + h->pred4x4 [DIAG_DOWN_RIGHT_PRED ] = ff_pred4x4_down_right_mmxext; + h->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_mmxext; + h->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_mmxext; + h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext; + if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264) { + h->pred4x4 [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_mmxext; + } + if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264) { + h->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_mmxext; + } + if (codec_id != CODEC_ID_RV40) { + h->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_mmxext; + } + if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264) { + h->pred8x8 [TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext; + h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_mmxext; + } + if (codec_id == CODEC_ID_VP8) { + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmxext; + h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext; + h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmxext; + h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmxext; + h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext; } else { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx2; + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx2; + if (codec_id == CODEC_ID_SVQ3) { + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_mmx2; + } else if (codec_id == CODEC_ID_RV40) { + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_mmx2; + } else { + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_mmx2; + } } } - } - if (mm_flags & AV_CPU_FLAG_SSE) { - h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse; - } + if (mm_flags & AV_CPU_FLAG_SSE) { + h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse; + } - if (mm_flags & AV_CPU_FLAG_SSE2) { - h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2; - h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2; - h->pred8x8l [DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_sse2; - h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_sse2; - h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_sse2; - h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_sse2; - if (codec_id == CODEC_ID_VP8) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2; - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2; - } else { - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_sse2; - if (codec_id == CODEC_ID_SVQ3) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_sse2; - } else if (codec_id == CODEC_ID_RV40) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_sse2; + if (mm_flags & AV_CPU_FLAG_SSE2) { + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2; + h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2; + h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_sse2; + h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_sse2; + h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_sse2; + h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_sse2; + if (codec_id == CODEC_ID_VP8) { + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_sse2; + h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_sse2; } else { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_sse2; + h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_plane_sse2; + if (codec_id == CODEC_ID_SVQ3) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_sse2; + } else if (codec_id == CODEC_ID_RV40) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_sse2; + } else { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_sse2; + } } } - } - if (mm_flags & AV_CPU_FLAG_SSSE3) { - h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3; - h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3; - h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3; - h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3; - h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_ssse3; - h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_ssse3; - h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_ssse3; - h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_ssse3; - h->pred8x8l [DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_ssse3; - h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_ssse3; - h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_ssse3; - h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_ssse3; - h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_ssse3; - if (codec_id == CODEC_ID_VP8) { - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_ssse3; - h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3; - } else { - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_ssse3; - if (codec_id == CODEC_ID_SVQ3) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_ssse3; - } else if (codec_id == CODEC_ID_RV40) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_ssse3; + if (mm_flags & AV_CPU_FLAG_SSSE3) { + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3; + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3; + h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3; + h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3; + h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_ssse3; + h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_ssse3; + h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_ssse3; + h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_ssse3; + h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_ssse3; + h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_ssse3; + h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_ssse3; + h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_ssse3; + h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_ssse3; + if (codec_id == CODEC_ID_VP8) { + h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_ssse3; + h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3; } else { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_ssse3; + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_ssse3; + if (codec_id == CODEC_ID_SVQ3) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_ssse3; + } else if (codec_id == CODEC_ID_RV40) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_ssse3; + } else { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_ssse3; + } } } - } -#endif } else if (bit_depth == 10) { -#if HAVE_YASM if (mm_flags & AV_CPU_FLAG_MMX2) { h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext; h->pred4x4[HOR_UP_PRED ] = ff_pred4x4_horizontal_up_10_mmxext; @@ -270,13 +270,13 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_ssse3; } #if HAVE_AVX - if (mm_flags&AV_CPU_FLAG_AVX) { + if (mm_flags & AV_CPU_FLAG_AVX) { h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_avx; h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_avx; h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_avx; h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_avx; } #endif /* HAVE_AVX */ -#endif /* HAVE_YASM */ } +#endif /* HAVE_YASM */ } |