diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-06 13:23:05 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-06 13:45:08 +0200 |
commit | 55c49afc42abae64e5ab25e04bc3c09b17c5b6d5 (patch) | |
tree | 3e56007e0d3039ee6aa91e0e87b9abc14a49bf94 | |
parent | 886c3662d308e97316a606732574f0e87b1cbe3a (diff) | |
parent | d3a72becc6371563185a509b94f5daf32ddbb485 (diff) | |
download | ffmpeg-55c49afc42abae64e5ab25e04bc3c09b17c5b6d5.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
yuv4mpeg: return proper error codes.
Give all anonymously typedeffed structs in headers a name
fate: Add parseutils test
parseutils-test: Drop random colors from parsing test
vf_pad/scale: use double precision for aspect ratios.
build: error on variable-length arrays
ppc: swscale: rework yuv2planeX_altivec()
ppc: fmtconvert: kill VLA in float_to_int16_interleave_altivec()
x86: dsputil: kill VLA in gmc_mmx()
libspeexenc: Updated commentary to reflect recent changes
libspeexenc: Add an option for enabling DTX
doc/APIchanges: fill in missing dates and hashes.
lavr: bump major to 1 and declare it stable.
lavr: change the type of the data buffers to uint8_t**.
lavc: deprecate the audio resampling API.
Conflicts:
cmdutils.h
configure
doc/APIchanges
ffplay.c
libavcodec/dwt.h
libavcodec/libspeexenc.c
libavfilter/vf_pad.c
libavfilter/vf_scale.c
libavformat/asf.h
tests/fate/libavutil.mak
tests/ref/fate/parseutils
Merged-by: Michael Niedermayer <michaelni@gmx.at>
77 files changed, 269 insertions, 293 deletions
diff --git a/cmdutils.h b/cmdutils.h index 1973c07317..2fd2fb4c39 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -139,7 +139,7 @@ typedef struct SpecifierOpt { } u; } SpecifierOpt; -typedef struct { +typedef struct OptionDef { const char *name; int flags; #define HAS_ARG 0x0001 @@ -3911,6 +3911,7 @@ elif enabled gcc; then check_optflags -fno-tree-vectorize check_cflags -Werror=implicit-function-declaration check_cflags -Werror=missing-prototypes +# check_cflags -Werror=vla elif enabled llvm_gcc; then check_cflags -mllvm -stack-alignment=16 elif enabled clang; then diff --git a/doc/APIchanges b/doc/APIchanges index b941c64d64..06b5a8e9ea 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -97,7 +97,12 @@ API changes, most recent first: 2012-03-26 - a67d9cf - lavfi 2.66.100 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. -2012-09-23 - a42aada - lavc 54.28.0 - avcodec.h +2012-10-05 - e7ba5b1 - lavr 1.0.0 - avresample.h + Data planes parameters to avresample_convert() and + avresample_read() are now uint8_t** instead of void**. + Libavresample is now stable. + +2012-09-24 - a42aada - lavc 54.28.0 - avcodec.h Add avcodec_free_frame(). This function must now be used for freeing an AVFrame. diff --git a/libavcodec/aac.h b/libavcodec/aac.h index a1e91b09b6..1070e5f310 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -113,7 +113,7 @@ enum OCStatus { OC_LOCKED, ///< Output configuration locked in place }; -typedef struct { +typedef struct OutputConfiguration { MPEG4AudioConfig m4ac; uint8_t layout_map[MAX_ELEM_ID*4][3]; int layout_map_tags; @@ -125,7 +125,7 @@ typedef struct { /** * Predictor State */ -typedef struct { +typedef struct PredictorState { float cor0; float cor1; float var0; @@ -146,7 +146,7 @@ typedef struct { /** * Long Term Prediction */ -typedef struct { +typedef struct LongTermPrediction { int8_t present; int16_t lag; float coef; @@ -156,7 +156,7 @@ typedef struct { /** * Individual Channel Stream */ -typedef struct { +typedef struct IndividualChannelStream { uint8_t max_sfb; ///< number of scalefactor bands per group enum WindowSequence window_sequence[2]; uint8_t use_kb_window[2]; ///< If set, use Kaiser-Bessel window, otherwise use a sinus window. @@ -177,7 +177,7 @@ typedef struct { /** * Temporal Noise Shaping */ -typedef struct { +typedef struct TemporalNoiseShaping { int present; int n_filt[8]; int length[8][4]; @@ -189,7 +189,7 @@ typedef struct { /** * Dynamic Range Control - decoded from the bitstream but not processed further. */ -typedef struct { +typedef struct DynamicRangeControl { int pce_instance_tag; ///< Indicates with which program the DRC info is associated. int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative int dyn_rng_ctl[17]; ///< DRC magnitude information @@ -202,7 +202,7 @@ typedef struct { */ } DynamicRangeControl; -typedef struct { +typedef struct Pulse { int num_pulse; int start; int pos[4]; @@ -212,7 +212,7 @@ typedef struct { /** * coupling parameters */ -typedef struct { +typedef struct ChannelCoupling { enum CouplingPoint coupling_point; ///< The point during decoding at which coupling is applied. int num_coupled; ///< number of target elements enum RawDataBlockType type[8]; ///< Type of channel element to be coupled - SCE or CPE. @@ -226,7 +226,7 @@ typedef struct { /** * Single Channel Element - used for both SCE and LFE elements. */ -typedef struct { +typedef struct SingleChannelElement { IndividualChannelStream ics; TemporalNoiseShaping tns; Pulse pulse; @@ -245,7 +245,7 @@ typedef struct { /** * channel element - generic struct for SCE/CPE/CCE/LFE */ -typedef struct { +typedef struct ChannelElement { // CPE specific int common_window; ///< Set if channels share a common 'IndividualChannelStream' in bitstream. int ms_mode; ///< Signals mid/side stereo flags coding mode (used by encoder) @@ -260,7 +260,7 @@ typedef struct { /** * main AAC context */ -typedef struct { +typedef struct AACContext { AVCodecContext *avctx; AVFrame frame; diff --git a/libavcodec/aacadtsdec.h b/libavcodec/aacadtsdec.h index fb2cbd9b35..d0584ef36a 100644 --- a/libavcodec/aacadtsdec.h +++ b/libavcodec/aacadtsdec.h @@ -28,7 +28,7 @@ #define AAC_ADTS_HEADER_SIZE 7 -typedef struct { +typedef struct AACADTSHeaderInfo { uint32_t sample_rate; uint32_t samples; uint32_t bit_rate; diff --git a/libavcodec/aacps.h b/libavcodec/aacps.h index d310c91b95..29323ffc0a 100644 --- a/libavcodec/aacps.h +++ b/libavcodec/aacps.h @@ -38,7 +38,7 @@ #define PS_AP_LINKS 3 #define PS_MAX_AP_DELAY 5 -typedef struct { +typedef struct PSContext { int start; int enable_iid; int iid_quant; diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h index b9f34b9d90..e609bb51ce 100644 --- a/libavcodec/ac3.h +++ b/libavcodec/ac3.h @@ -93,7 +93,7 @@ typedef struct AC3BitAllocParameters { * @struct AC3HeaderInfo * Coded AC-3 header values up to the lfeon element, plus derived values. */ -typedef struct { +typedef struct AC3HeaderInfo { /** @name Coded elements * @{ */ diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h index e0f3dc7be4..c3a43bf5cf 100644 --- a/libavcodec/ac3dec.h +++ b/libavcodec/ac3dec.h @@ -65,7 +65,7 @@ /** Large enough for maximum possible frame size when the specification limit is ignored */ #define AC3_FRAME_BUFFER_SIZE 32768 -typedef struct { +typedef struct AC3DecodeContext { AVClass *class; ///< class for AVOptions AVCodecContext *avctx; ///< parent context AVFrame frame; ///< AVFrame for decoded output diff --git a/libavcodec/acelp_vectors.h b/libavcodec/acelp_vectors.h index d92f288de4..fae834dac1 100644 --- a/libavcodec/acelp_vectors.h +++ b/libavcodec/acelp_vectors.h @@ -50,7 +50,7 @@ void ff_acelp_vectors_init(ACELPVContext *c); void ff_acelp_vectors_init_mips(ACELPVContext *c); /** Sparse representation for the algebraic codebook (fixed) vector */ -typedef struct { +typedef struct AMRFixed { int n; int x[10]; float y[10]; diff --git a/libavcodec/adx.h b/libavcodec/adx.h index a14ddce499..85b35d15be 100644 --- a/libavcodec/adx.h +++ b/libavcodec/adx.h @@ -35,11 +35,11 @@ #include "avcodec.h" -typedef struct { +typedef struct ADXChannelState { int s1,s2; } ADXChannelState; -typedef struct { +typedef struct ADXContext { AVFrame frame; int channels; ADXChannelState prev[2]; diff --git a/libavcodec/amrnbdata.h b/libavcodec/amrnbdata.h index 6e555bfdb4..435fd9924b 100644 --- a/libavcodec/amrnbdata.h +++ b/libavcodec/amrnbdata.h @@ -55,7 +55,7 @@ enum Mode { /** * AMRNB unpacked data subframe */ -typedef struct { +typedef struct AMRNBSubframe { uint16_t p_lag; ///< index to decode the pitch lag uint16_t p_gain; ///< index to decode the pitch gain uint16_t fixed_gain; ///< index to decode the fixed gain factor, for MODE_12k2 and MODE_7k95 @@ -65,7 +65,7 @@ typedef struct { /** * AMRNB unpacked data frame */ -typedef struct { +typedef struct AMRNBFrame { uint16_t lsf[5]; ///< lsf parameters: 5 parameters for MODE_12k2, only 3 for other modes AMRNBSubframe subframe[4]; ///< unpacked data for each subframe } AMRNBFrame; diff --git a/libavcodec/amrwbdata.h b/libavcodec/amrwbdata.h index 83390fc393..8390582b05 100644 --- a/libavcodec/amrwbdata.h +++ b/libavcodec/amrwbdata.h @@ -66,7 +66,7 @@ enum Mode { /* All decoded parameters in these structs must be 2 bytes long * because of the direct indexing at the frame parsing */ -typedef struct { +typedef struct AMRWBSubFrame { uint16_t adap; ///< adaptive codebook index uint16_t ltp; ///< ltp-filtering flag uint16_t vq_gain; ///< VQ adaptive and innovative gains @@ -75,7 +75,7 @@ typedef struct { uint16_t pul_il[4]; ///< LSBs part of codebook index } AMRWBSubFrame; -typedef struct { +typedef struct AMRWBFrame { uint16_t vad; ///< voice activity detection flag uint16_t isp_id[7]; ///< index of ISP subvectors AMRWBSubFrame subframe[4]; ///< data for subframes diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 2683ee5887..719921a779 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4323,9 +4323,11 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, * @} */ +#if FF_API_AVCODEC_RESAMPLE /** * @defgroup lavc_resample Audio resampling * @ingroup libavc + * @deprecated use libswresample instead * * @{ */ @@ -4350,6 +4352,7 @@ typedef struct ReSampleContext ReSampleContext; * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate * @return allocated ReSampleContext, NULL if error occurred */ +attribute_deprecated ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate, enum AVSampleFormat sample_fmt_out, @@ -4357,6 +4360,7 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int filter_length, int log2_phase_count, int linear, double cutoff); +attribute_deprecated int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); /** @@ -4365,6 +4369,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl * @param s a non-NULL pointer to a resample context previously * created with av_audio_resample_init() */ +attribute_deprecated void audio_resample_close(ReSampleContext *s); @@ -4377,6 +4382,7 @@ void audio_resample_close(ReSampleContext *s); between the 2 closest, if 0 the closest will be used * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate */ +attribute_deprecated struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); /** @@ -4388,6 +4394,7 @@ struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. * @return the number of samples written in dst or -1 if an error occurred */ +attribute_deprecated int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); @@ -4403,12 +4410,15 @@ int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consum * note, due to rounding the actual compensation might be slightly different, * especially if the compensation_distance is large and the in_rate used during init is small */ +attribute_deprecated void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); +attribute_deprecated void av_resample_close(struct AVResampleContext *c); /** * @} */ +#endif /** * @addtogroup lavc_picture diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h index 39a1e28a12..af7f75bd45 100644 --- a/libavcodec/bytestream.h +++ b/libavcodec/bytestream.h @@ -29,11 +29,11 @@ #include "libavutil/common.h" #include "libavutil/intreadwrite.h" -typedef struct { +typedef struct GetByteContext { const uint8_t *buffer, *buffer_end, *buffer_start; } GetByteContext; -typedef struct { +typedef struct PutByteContext { uint8_t *buffer, *buffer_end, *buffer_start; int eof; } PutByteContext; diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h index 461d7c8ba8..039053dddb 100644 --- a/libavcodec/cavs.h +++ b/libavcodec/cavs.h @@ -152,7 +152,7 @@ struct dec_2dvlc { int8_t max_run; }; -typedef struct { +typedef struct AVSContext { MpegEncContext s; CAVSDSPContext cdsp; Picture picture; ///< currently decoded frame diff --git a/libavcodec/dirac.h b/libavcodec/dirac.h index 542d4910f8..b0f955bf46 100644 --- a/libavcodec/dirac.h +++ b/libavcodec/dirac.h @@ -34,7 +34,7 @@ #include "avcodec.h" #include "get_bits.h" -typedef struct { +typedef struct dirac_source_params { unsigned width; unsigned height; uint8_t chroma_format; ///< 0: 444 1: 422 2: 420 diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h index 6e774b5c88..6ebee3d0f3 100644 --- a/libavcodec/dnxhddata.h +++ b/libavcodec/dnxhddata.h @@ -25,7 +25,7 @@ #include <stdint.h> #include "avcodec.h" -typedef struct { +typedef struct CIDEntry { int cid; unsigned int width, height; int interlaced; diff --git a/libavcodec/dnxhdenc.h b/libavcodec/dnxhdenc.h index e57047d5dc..36a42fb100 100644 --- a/libavcodec/dnxhdenc.h +++ b/libavcodec/dnxhdenc.h @@ -29,12 +29,12 @@ #include "mpegvideo.h" #include "dnxhddata.h" -typedef struct { +typedef struct RCCMPEntry { uint16_t mb; int value; } RCCMPEntry; -typedef struct { +typedef struct RCEntry { int ssd; int bits; } RCEntry; diff --git a/libavcodec/dwt.h b/libavcodec/dwt.h index 6df32f39f2..d82e510006 100644 --- a/libavcodec/dwt.h +++ b/libavcodec/dwt.h @@ -29,7 +29,7 @@ typedef short IDWTELEM; #define MAX_DWT_SUPPORT 8 #define MAX_DECOMPOSITIONS 8 -typedef struct { +typedef struct DWTCompose { IDWTELEM *b[MAX_DWT_SUPPORT]; IDWTELEM *b0; diff --git a/libavcodec/g722.h b/libavcodec/g722.h index eb3b9b872e..bab1da48cc 100644 --- a/libavcodec/g722.h +++ b/libavcodec/g722.h @@ -30,7 +30,7 @@ #define PREV_SAMPLES_BUF_SIZE 1024 -typedef struct { +typedef struct G722Context { const AVClass *class; AVFrame frame; int bits_per_codeword; diff --git a/libavcodec/gsmdec_data.h b/libavcodec/gsmdec_data.h index 3eb30b84b7..6abe2b47b3 100644 --- a/libavcodec/gsmdec_data.h +++ b/libavcodec/gsmdec_data.h @@ -25,7 +25,7 @@ #include <stdint.h> #include "avcodec.h" -typedef struct { +typedef struct GSMContext { AVFrame frame; // Contains first 120 elements from the previous frame // (used by long_term_synth according to the "lag"), diff --git a/libavcodec/huffman.h b/libavcodec/huffman.h index 2fdf88d405..4f9ccbad50 100644 --- a/libavcodec/huffman.h +++ b/libavcodec/huffman.h @@ -29,7 +29,7 @@ #include "avcodec.h" #include "get_bits.h" -typedef struct { +typedef struct Node { int16_t sym; int16_t n0; uint32_t count; diff --git a/libavcodec/indeo3data.h b/libavcodec/indeo3data.h index e6f370c84d..0b5648eb20 100644 --- a/libavcodec/indeo3data.h +++ b/libavcodec/indeo3data.h @@ -320,7 +320,7 @@ static const int32_t delta_tab_3_4_m10[79] = { TAB_3_4 }; static const int32_t delta_tab_3_5_m10[79] = { TAB_3_5 }; -typedef struct { +typedef struct vqEntry { const int16_t *deltas; ///< delta tables for 4x4 block modes const int32_t *deltas_m10; ///< delta tables for 8x8 block modes uint8_t num_dyads; ///< number of two-pixel deltas diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h index dd2dc7d696..40d689a93c 100644 --- a/libavcodec/intrax8.h +++ b/libavcodec/intrax8.h @@ -23,7 +23,7 @@ #include "mpegvideo.h" #include "intrax8dsp.h" -typedef struct{ +typedef struct IntraX8Context { VLC * j_ac_vlc[4];//they point to the static j_mb_vlc VLC * j_orient_vlc; VLC * j_dc_vlc[3]; diff --git a/libavcodec/ivi_common.h b/libavcodec/ivi_common.h index 4636f6ce52..44b28cd231 100644 --- a/libavcodec/ivi_common.h +++ b/libavcodec/ivi_common.h @@ -40,7 +40,7 @@ /** * huffman codebook descriptor */ -typedef struct { +typedef struct IVIHuffDesc { int32_t num_rows; uint8_t xbits[16]; } IVIHuffDesc; @@ -48,7 +48,7 @@ typedef struct { /** * macroblock/block huffman table descriptor */ -typedef struct { +typedef struct IVIHuffTab { int32_t tab_sel; /// index of one of the predefined tables /// or "7" for custom one VLC *tab; /// pointer to the table associated with tab_sel @@ -85,7 +85,7 @@ typedef void (DCTransformPtr) (const int32_t *in, int16_t *out, uint32_t pitch, /** * run-value (RLE) table descriptor */ -typedef struct { +typedef struct RVMapDesc { uint8_t eob_sym; ///< end of block symbol uint8_t esc_sym; ///< escape symbol uint8_t runtab[256]; @@ -98,7 +98,7 @@ extern const RVMapDesc ff_ivi_rvmap_tabs[9]; /** * information for Indeo macroblock (16x16, 8x8 or 4x4) */ -typedef struct { +typedef struct IVIMbInfo { int16_t xpos; int16_t ypos; uint32_t buf_offs; ///< address in the output buffer for this mb @@ -113,7 +113,7 @@ typedef struct { /** * information for Indeo tile */ -typedef struct { +typedef struct IVITile { int xpos; int ypos; int width; @@ -130,7 +130,7 @@ typedef struct { /** * information for Indeo wavelet band */ -typedef struct { +typedef struct IVIBandDesc { int plane; ///< plane number this band belongs to int band_num; ///< band number int width; @@ -178,7 +178,7 @@ typedef struct { /** * color plane (luma or chroma) information */ -typedef struct { +typedef struct IVIPlaneDesc { uint16_t width; uint16_t height; uint8_t num_bands; ///< number of bands this plane subdivided into @@ -186,7 +186,7 @@ typedef struct { } IVIPlaneDesc; -typedef struct { +typedef struct IVIPicConfig { uint16_t pic_width; uint16_t pic_height; uint16_t chroma_width; diff --git a/libavcodec/libschroedinger.h b/libavcodec/libschroedinger.h index bacc0da050..df8ab985be 100644 --- a/libavcodec/libschroedinger.h +++ b/libavcodec/libschroedinger.h @@ -31,7 +31,7 @@ #include "avcodec.h" -typedef struct { +typedef struct SchroVideoFormatInfo { uint16_t width; uint16_t height; uint16_t frame_rate_num; diff --git a/libavcodec/libspeexenc.c b/libavcodec/libspeexenc.c index e3db143f75..fb597efb6e 100644 --- a/libavcodec/libspeexenc.c +++ b/libavcodec/libspeexenc.c @@ -219,7 +219,7 @@ static av_cold int encode_init(AVCodecContext *avctx) /* Activiting Discontinuous Transmission */ if (s->dtx) { speex_encoder_ctl(s->enc_state, SPEEX_SET_DTX, &s->dtx); - if ( !(s->abr || s->vad || s->header.vbr)) + if (!(s->abr || s->vad || s->header.vbr)) av_log(avctx, AV_LOG_WARNING, "DTX is not much of use without ABR, VAD or VBR\n"); } diff --git a/libavcodec/mlp.h b/libavcodec/mlp.h index 628b58d318..d8d1292903 100644 --- a/libavcodec/mlp.h +++ b/libavcodec/mlp.h @@ -71,7 +71,7 @@ #define IIR 1 /** filter data */ -typedef struct { +typedef struct FilterParams { uint8_t order; ///< number of taps in filter uint8_t shift; ///< Right shift to apply to output of filter. @@ -79,7 +79,7 @@ typedef struct { } FilterParams; /** sample data coding information */ -typedef struct { +typedef struct ChannelParams { FilterParams filter_params[NUM_FILTERS]; int32_t coeff[NUM_FILTERS][MAX_FIR_ORDER]; diff --git a/libavcodec/mpc.h b/libavcodec/mpc.h index 34ef263b40..7ee402b356 100644 --- a/libavcodec/mpc.h +++ b/libavcodec/mpc.h @@ -41,7 +41,7 @@ #define MPC_FRAME_SIZE (BANDS * SAMPLES_PER_BAND) /** Subband structure - hold all variables for each subband */ -typedef struct { +typedef struct Band { int msf; ///< mid-stereo flag int res[2]; int scfi[2]; @@ -49,7 +49,7 @@ typedef struct { int Q[2]; }Band; -typedef struct { +typedef struct MPCContext { AVFrame frame; DSPContext dsp; MPADSPContext mpadsp; diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index 21000a9acc..64839c6617 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -26,7 +26,7 @@ #include "get_bits.h" #include "put_bits.h" -typedef struct { +typedef struct MPEG4AudioConfig { int object_type; int sampling_index; int sample_rate; diff --git a/libavcodec/ppc/fmtconvert_altivec.c b/libavcodec/ppc/fmtconvert_altivec.c index 3cb11543dd..7eff9f04d1 100644 --- a/libavcodec/ppc/fmtconvert_altivec.c +++ b/libavcodec/ppc/fmtconvert_altivec.c @@ -83,6 +83,22 @@ static void float_to_int16_altivec(int16_t *dst, const float *src, long len) } } +static void float_to_int16_stride_altivec(int16_t *dst, const float *src, + long len, int stride) +{ + int i, j; + vector signed short d, s; + + for (i = 0; i < len - 7; i += 8) { + d = float_to_int16_one_altivec(src + i); + for (j = 0; j < 8; j++) { + s = vec_splat(d, j); + vec_ste(s, 0, dst); + dst += stride; + } + } +} + static void float_to_int16_interleave_altivec(int16_t *dst, const float **src, long len, int channels) { @@ -124,13 +140,8 @@ static void float_to_int16_interleave_altivec(int16_t *dst, const float **src, } } } else { - DECLARE_ALIGNED(16, int16_t, tmp)[len]; - int c, j; - for (c = 0; c < channels; c++) { - float_to_int16_altivec(tmp, src[c], len); - for (i = 0, j = c; i < len; i++, j+=channels) - dst[j] = tmp[i]; - } + for (i = 0; i < channels; i++) + float_to_int16_stride_altivec(dst + i, src[i], len, channels); } } } diff --git a/libavcodec/proresdsp.h b/libavcodec/proresdsp.h index a35e0d627e..09541d9642 100644 --- a/libavcodec/proresdsp.h +++ b/libavcodec/proresdsp.h @@ -27,7 +27,7 @@ #define PRORES_BITS_PER_SAMPLE 10 ///< output precision of prores decoder -typedef struct { +typedef struct ProresDSPContext { int idct_permutation_type; uint8_t idct_permutation[64]; int dct_permutation_type; diff --git a/libavcodec/qcelpdata.h b/libavcodec/qcelpdata.h index 4a7dcdb38b..d58e9f8316 100644 --- a/libavcodec/qcelpdata.h +++ b/libavcodec/qcelpdata.h @@ -37,7 +37,7 @@ /** * QCELP unpacked data frame */ -typedef struct { +typedef struct QCELPFrame { /// @name QCELP excitation codebook parameters /// @{ uint8_t cbsign[16]; ///< sign of the codebook gain for each codebook subframe @@ -73,7 +73,7 @@ typedef struct { */ static const float qcelp_hammsinc_table[4] = { -0.006822, 0.041249, -0.143459, 0.588863}; -typedef struct { +typedef struct QCELPBitmap { uint8_t index; /**< index into the QCELPContext structure */ uint8_t bitpos; /**< position of the lowest bit in the value's byte */ uint8_t bitlen; /**< number of bits to read */ diff --git a/libavcodec/ra144.h b/libavcodec/ra144.h index 03c4860367..331dc35f3c 100644 --- a/libavcodec/ra144.h +++ b/libavcodec/ra144.h @@ -33,7 +33,7 @@ #define FRAMESIZE 20 ///< size of encoded frame #define LPC_ORDER 10 ///< order of LPC filter -typedef struct { +typedef struct RA144Context { AVCodecContext *avctx; AVFrame frame; LPCContext lpc_ctx; diff --git a/libavcodec/resample.c b/libavcodec/resample.c index 04e5aab371..dfaad66216 100644 --- a/libavcodec/resample.c +++ b/libavcodec/resample.c @@ -32,6 +32,8 @@ #include "libavutil/mem.h" #include "libavutil/samplefmt.h" +#if FF_API_AVCODEC_RESAMPLE + #define MAX_CHANNELS 8 struct AVResampleContext; @@ -429,3 +431,5 @@ void audio_resample_close(ReSampleContext *s) av_audio_convert_free(s->convert_ctx[1]); av_free(s); } + +#endif diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c index 38186121ca..3a3cd13dfe 100644 --- a/libavcodec/resample2.c +++ b/libavcodec/resample2.c @@ -30,6 +30,8 @@ #include "dsputil.h" #include "libavutil/common.h" +#if FF_API_AVCODEC_RESAMPLE + #ifndef CONFIG_RESAMPLE_HP #define FILTER_SHIFT 15 @@ -321,3 +323,5 @@ av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->comp return dst_index; } + +#endif diff --git a/libavcodec/roqvideo.h b/libavcodec/roqvideo.h index 6fc7161c8a..2f9493d3b6 100644 --- a/libavcodec/roqvideo.h +++ b/libavcodec/roqvideo.h @@ -27,16 +27,16 @@ #include "bytestream.h" #include "dsputil.h" -typedef struct { +typedef struct roq_cell { unsigned char y[4]; unsigned char u, v; } roq_cell; -typedef struct { +typedef struct roq_qcell { int idx[4]; } roq_qcell; -typedef struct { +typedef struct motion_vect { int d[2]; } motion_vect; diff --git a/libavcodec/rtjpeg.h b/libavcodec/rtjpeg.h index 5b359db9eb..0fd24a356c 100644 --- a/libavcodec/rtjpeg.h +++ b/libavcodec/rtjpeg.h @@ -29,7 +29,7 @@ #define RTJPEG_FILE_VERSION 0 #define RTJPEG_HEADER_SIZE 12 -typedef struct { +typedef struct RTJpegContext { int w, h; DSPContext *dsp; uint8_t scan[64]; diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h index e68b3cf916..7c0afdc84c 100644 --- a/libavcodec/sbr.h +++ b/libavcodec/sbr.h @@ -37,7 +37,7 @@ /** * Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header. */ -typedef struct { +typedef struct SpectrumParameters { uint8_t bs_start_freq; uint8_t bs_stop_freq; uint8_t bs_xover_band; @@ -57,7 +57,7 @@ typedef struct { /** * Spectral Band Replication per channel data */ -typedef struct { +typedef struct SBRData { /** * @name Main bitstream data variables * @{ @@ -111,7 +111,7 @@ typedef struct { /** * Spectral Band Replication */ -typedef struct { +typedef struct SpectralBandReplication { int sample_rate; int start; int reset; diff --git a/libavcodec/version.h b/libavcodec/version.h index 39888179b5..b2f4bb010f 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -94,5 +94,8 @@ #ifndef FF_API_VDA_ASYNC #define FF_API_VDA_ASYNC (LIBAVCODEC_VERSION_MAJOR < 55) #endif +#ifndef FF_API_AVCODEC_RESAMPLE +#define FF_API_AVCODEC_RESAMPLE (LIBAVCODEC_VERSION_MAJOR < 55) +#endif #endif /* AVCODEC_VERSION_H */ diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h index 14045ec53e..0bab0b9c0f 100644 --- a/libavcodec/vorbis.h +++ b/libavcodec/vorbis.h @@ -29,7 +29,7 @@ extern const uint8_t ff_vorbis_channel_layout_offsets[8][8]; extern const uint8_t ff_vorbis_encoding_channel_layout_offsets[8][8]; extern const uint64_t ff_vorbis_channel_layouts[9]; -typedef struct { +typedef struct vorbis_floor1_entry { uint16_t x; uint16_t sort; uint16_t low; diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h index 44bd229a6d..65245a2246 100644 --- a/libavcodec/vp56.h +++ b/libavcodec/vp56.h @@ -35,7 +35,7 @@ typedef struct vp56_context VP56Context; -typedef struct { +typedef struct VP56mv { DECLARE_ALIGNED(4, int16_t, x); int16_t y; } VP56mv; @@ -52,7 +52,7 @@ typedef int (*VP56ParseCoeffModels)(VP56Context *s); typedef int (*VP56ParseHeader)(VP56Context *s, const uint8_t *buf, int buf_size); -typedef struct { +typedef struct VP56RangeCoder { int high; int bits; /* stored negated (i.e. negative "bits" is a positive number of bits left) in order to eliminate a negate in cache refilling */ @@ -61,18 +61,18 @@ typedef struct { unsigned int code_word; } VP56RangeCoder; -typedef struct { +typedef struct VP56RefDc { uint8_t not_null_dc; VP56Frame ref_frame; DCTELEM dc_coeff; } VP56RefDc; -typedef struct { +typedef struct VP56Macroblock { uint8_t type; VP56mv mv; } VP56Macroblock; -typedef struct { +typedef struct VP56Model { uint8_t coeff_reorder[64]; /* used in vp6 only */ uint8_t coeff_index_to_pos[64]; /* used in vp6 only */ uint8_t vector_sig[2]; /* delta sign */ diff --git a/libavcodec/vp56data.h b/libavcodec/vp56data.h index d48a89cbe9..f30732ed94 100644 --- a/libavcodec/vp56data.h +++ b/libavcodec/vp56data.h @@ -51,7 +51,7 @@ typedef enum { VP56_MB_INTER_V2_GF = 9, /**< Inter MB, second vector, from golden frame */ } VP56mb; -typedef struct { +typedef struct VP56Tree { int8_t val; int8_t prob_idx; } VP56Tree; diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h index 4f026dfe8d..eb4aad278f 100644 --- a/libavcodec/vp8.h +++ b/libavcodec/vp8.h @@ -72,13 +72,13 @@ enum inter_splitmvmode { VP8_SPLITMVMODE_NONE, ///< (only used in prediction) no split MVs }; -typedef struct { +typedef struct VP8FilterStrength { uint8_t filter_level; uint8_t inner_limit; uint8_t inner_filter; } VP8FilterStrength; -typedef struct { +typedef struct VP8Macroblock { uint8_t skip; // todo: make it possible to check for at least (i4x4 or split_mv) // in one op. are others needed? @@ -93,7 +93,7 @@ typedef struct { VP56mv bmv[16]; } VP8Macroblock; -typedef struct { +typedef struct VP8ThreadData { DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16]; DECLARE_ALIGNED(16, DCTELEM, block_dc)[16]; /** @@ -123,7 +123,7 @@ typedef struct { } VP8ThreadData; #define MAX_THREADS 8 -typedef struct { +typedef struct VP8Context { VP8ThreadData *thread_data; AVCodecContext *avctx; AVFrame *framep[4]; diff --git a/libavcodec/w32pthreads.h b/libavcodec/w32pthreads.h index c4bbb9a51b..29185c71ec 100644 --- a/libavcodec/w32pthreads.h +++ b/libavcodec/w32pthreads.h @@ -43,7 +43,7 @@ #include "libavutil/internal.h" #include "libavutil/mem.h" -typedef struct { +typedef struct pthread_t { void *handle; void *(*func)(void* arg); void *arg; @@ -57,7 +57,7 @@ typedef CRITICAL_SECTION pthread_mutex_t; /* This is the CONDITIONAL_VARIABLE typedef for using Window's native * conditional variables on kernels 6.0+. * MinGW does not currently have this typedef. */ -typedef struct { +typedef struct pthread_cond_t { void *ptr; } pthread_cond_t; @@ -118,7 +118,7 @@ static inline int pthread_mutex_unlock(pthread_mutex_t *m) /* for pre-Windows 6.0 platforms we need to define and use our own condition * variable and api */ -typedef struct { +typedef struct win32_cond_t { pthread_mutex_t mtx_broadcast; pthread_mutex_t mtx_waiter_count; volatile int waiter_count; diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index c36a027229..f608f661dd 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -1929,15 +1929,10 @@ static av_noinline void emulated_edge_mc_sse(uint8_t *buf, const uint8_t *src, #if HAVE_INLINE_ASM -typedef void emulated_edge_mc_func(uint8_t *dst, const uint8_t *src, - int linesize, int block_w, int block_h, - int src_x, int src_y, int w, int h); - -static av_always_inline void gmc(uint8_t *dst, uint8_t *src, - int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, - int shift, int r, int width, int height, - emulated_edge_mc_func *emu_edge_fn) +static void gmc_mmx(uint8_t *dst, uint8_t *src, + int stride, int h, int ox, int oy, + int dxx, int dxy, int dyx, int dyy, + int shift, int r, int width, int height) { const int w = 8; const int ix = ox >> (16 + shift); @@ -1952,7 +1947,6 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src, const uint16_t dxy4[4] = { dxys, dxys, dxys, dxys }; const uint16_t dyy4[4] = { dyys, dyys, dyys, dyys }; const uint64_t shift2 = 2 * shift; - uint8_t edge_buf[(h + 1) * stride]; int x, y; const int dxw = (dxx - (1 << (16 + shift))) * (w - 1); @@ -1963,7 +1957,9 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src, ((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) | (oy ^ (oy + dyw)) | (oy ^ (oy + dyh)) | (oy ^ (oy + dyw + dyh))) >> (16 + shift) // uses more than 16 bits of subpel mv (only at huge resolution) - || (dxx | dxy | dyx | dyy) & 15) { + || (dxx | dxy | dyx | dyy) & 15 || + (unsigned)ix >= width - w || + (unsigned)iy >= height - h) { // FIXME could still use mmx for some of the rows ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, width, height); @@ -1971,11 +1967,6 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src, } src += ix + iy * stride; - if ((unsigned)ix >= width - w || - (unsigned)iy >= height - h) { - emu_edge_fn(edge_buf, src, stride, w + 1, h + 1, ix, iy, width, height); - src = edge_buf; - } __asm__ volatile ( "movd %0, %%mm6 \n\t" @@ -2054,36 +2045,6 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src, } } -#if HAVE_YASM -#if ARCH_X86_32 -static void gmc_mmx(uint8_t *dst, uint8_t *src, - int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, - int shift, int r, int width, int height) -{ - gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, - width, height, &emulated_edge_mc_mmx); -} -#endif -static void gmc_sse(uint8_t *dst, uint8_t *src, - int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, - int shift, int r, int width, int height) -{ - gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, - width, height, &emulated_edge_mc_sse); -} -#else -static void gmc_mmx(uint8_t *dst, uint8_t *src, - int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, - int shift, int r, int width, int height) -{ - gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, - width, height, &ff_emulated_edge_mc_8); -} -#endif - #define PREFETCH(name, op) \ static void name(void *mem, int stride, int h) \ { \ @@ -2584,9 +2545,7 @@ static void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, int mm_flags) SET_HPEL_FUNCS(avg_no_rnd, 1, 8, mmx); } -#if ARCH_X86_32 || !HAVE_YASM c->gmc = gmc_mmx; -#endif c->add_bytes = add_bytes_mmx; @@ -2841,9 +2800,6 @@ static void dsputil_init_sse(DSPContext *c, AVCodecContext *avctx, int mm_flags) if (!high_bit_depth) c->emulated_edge_mc = emulated_edge_mc_sse; -#if HAVE_INLINE_ASM - c->gmc = gmc_sse; -#endif #endif /* HAVE_YASM */ } diff --git a/libavcodec/x86/dsputil_mmx.h b/libavcodec/x86/dsputil_mmx.h index 100381cb48..16d741d573 100644 --- a/libavcodec/x86/dsputil_mmx.h +++ b/libavcodec/x86/dsputil_mmx.h @@ -26,7 +26,7 @@ #include "libavcodec/dsputil.h" #include "libavutil/x86/asm.h" -typedef struct { uint64_t a, b; } xmm_reg; +typedef struct xmm_reg { uint64_t a, b; } xmm_reg; extern const uint64_t ff_bone; extern const uint64_t ff_wtwo; diff --git a/libavdevice/alsa-audio.h b/libavdevice/alsa-audio.h index 00acf9f3ee..44b7c72fc0 100644 --- a/libavdevice/alsa-audio.h +++ b/libavdevice/alsa-audio.h @@ -45,7 +45,7 @@ typedef void (*ff_reorder_func)(const void *, void *, int); #define ALSA_BUFFER_SIZE_MAX 65536 -typedef struct { +typedef struct AlsaData { AVClass *class; snd_pcm_t *h; int frame_size; ///< bytes per sample * channels diff --git a/libavdevice/sndio_common.h b/libavdevice/sndio_common.h index 5111dc7a92..74f41f59bf 100644 --- a/libavdevice/sndio_common.h +++ b/libavdevice/sndio_common.h @@ -28,7 +28,7 @@ #include "libavutil/log.h" #include "avdevice.h" -typedef struct { +typedef struct SndioData { AVClass *class; struct sio_hdl *hdl; enum AVCodecID codec_id; diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c index 18892d4826..41cb47565e 100644 --- a/libavfilter/af_asyncts.c +++ b/libavfilter/af_asyncts.c @@ -127,7 +127,7 @@ static int request_frame(AVFilterLink *link) nb_samples); if (!buf) return AVERROR(ENOMEM); - ret = avresample_convert(s->avr, (void**)buf->extended_data, + ret = avresample_convert(s->avr, buf->extended_data, buf->linesize[0], nb_samples, NULL, 0, 0); if (ret <= 0) { avfilter_unref_bufferp(&buf); @@ -143,7 +143,7 @@ static int request_frame(AVFilterLink *link) static int write_to_fifo(ASyncContext *s, AVFilterBufferRef *buf) { - int ret = avresample_convert(s->avr, NULL, 0, 0, (void**)buf->extended_data, + int ret = avresample_convert(s->avr, NULL, 0, 0, buf->extended_data, buf->linesize[0], buf->audio->nb_samples); avfilter_unref_buffer(buf); return ret; @@ -204,7 +204,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf) goto fail; } - avresample_read(s->avr, (void**)buf_out->extended_data, out_size); + avresample_read(s->avr, buf_out->extended_data, out_size); buf_out->pts = s->pts; if (delta > 0) { @@ -224,7 +224,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf) avresample_read(s->avr, NULL, avresample_available(s->avr)); s->pts = pts - avresample_get_delay(s->avr); - ret = avresample_convert(s->avr, NULL, 0, 0, (void**)buf->extended_data, + ret = avresample_convert(s->avr, NULL, 0, 0, buf->extended_data, buf->linesize[0], buf->audio->nb_samples); fail: diff --git a/libavfilter/af_resample.c b/libavfilter/af_resample.c index eb2d2f9e21..c51f9d243b 100644 --- a/libavfilter/af_resample.c +++ b/libavfilter/af_resample.c @@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *outlink) if (!buf) return AVERROR(ENOMEM); - ret = avresample_convert(s->avr, (void**)buf->extended_data, + ret = avresample_convert(s->avr, buf->extended_data, buf->linesize[0], nb_samples, NULL, 0, 0); if (ret <= 0) { @@ -186,9 +186,9 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf) goto fail; } - ret = avresample_convert(s->avr, (void**)buf_out->extended_data, + ret = avresample_convert(s->avr, buf_out->extended_data, buf_out->linesize[0], nb_samples, - (void**)buf->extended_data, buf->linesize[0], + buf->extended_data, buf->linesize[0], buf->audio->nb_samples); if (ret < 0) { avfilter_unref_buffer(buf_out); diff --git a/libavfilter/gradfun.h b/libavfilter/gradfun.h index 3ceb13397d..939b129aaa 100644 --- a/libavfilter/gradfun.h +++ b/libavfilter/gradfun.h @@ -25,7 +25,7 @@ #include "avfilter.h" /// Holds instance-specific information for gradfun. -typedef struct { +typedef struct GradFunContext { int thresh; ///< threshold for gradient algorithm int radius; ///< blur radius int chroma_w; ///< width of the chroma planes diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 7d2ea92a7f..9918272924 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -126,9 +126,9 @@ static int config_input(AVFilterLink *inlink) var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h; var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN; var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; - var_values[VAR_A] = (float) inlink->w / inlink->h; + var_values[VAR_A] = (double) inlink->w / inlink->h; var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? - (float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1; + (double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1; var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR]; var_values[VAR_HSUB] = 1 << pad->draw.hsub_max; var_values[VAR_VSUB] = 1 << pad->draw.vsub_max; diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 49988bfbd8..c7cbdfe2c8 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -172,9 +172,9 @@ static int config_props(AVFilterLink *outlink) var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h; var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN; var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; - var_values[VAR_A] = (float) inlink->w / inlink->h; + var_values[VAR_A] = (double) inlink->w / inlink->h; var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? - (float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1; + (double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1; var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR]; var_values[VAR_HSUB] = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_w; var_values[VAR_VSUB] = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_h; diff --git a/libavfilter/yadif.h b/libavfilter/yadif.h index 45bb1dc8ee..41691de65d 100644 --- a/libavfilter/yadif.h +++ b/libavfilter/yadif.h @@ -22,7 +22,7 @@ #include "libavutil/pixdesc.h" #include "avfilter.h" -typedef struct { +typedef struct YADIFContext { /** * 0: send 1 frame for each frame * 1: send 1 frame for each field diff --git a/libavformat/asf.h b/libavformat/asf.h index 5562865f68..822cd6bbea 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -28,7 +28,7 @@ #define PACKET_SIZE 3200 -typedef struct { +typedef struct ASFStream { int num; unsigned char seq; /* use for reading */ @@ -49,7 +49,7 @@ typedef struct { uint32_t palette[256]; } ASFStream; -typedef struct { +typedef struct ASFMainHeader { ff_asf_guid guid; ///< generated by client computer uint64_t file_size; /**< in bytes * invalid if broadcasting */ @@ -75,7 +75,7 @@ typedef struct { } ASFMainHeader; -typedef struct { +typedef struct ASFIndex { uint32_t packet_number; uint16_t packet_count; } ASFIndex; diff --git a/libavformat/audiointerleave.h b/libavformat/audiointerleave.h index b37c8aefbd..4d77832fa1 100644 --- a/libavformat/audiointerleave.h +++ b/libavformat/audiointerleave.h @@ -26,7 +26,7 @@ #include "libavutil/fifo.h" #include "avformat.h" -typedef struct { +typedef struct AudioInterleaveContext { AVFifoBuffer *fifo; unsigned fifo_size; ///< size of currently allocated FIFO uint64_t dts; ///< current dts diff --git a/libavformat/httpauth.h b/libavformat/httpauth.h index 62dd25e637..fc17c94859 100644 --- a/libavformat/httpauth.h +++ b/libavformat/httpauth.h @@ -32,7 +32,7 @@ typedef enum HTTPAuthType { HTTP_AUTH_DIGEST, /**< HTTP 1.1 Digest auth from RFC 2617 */ } HTTPAuthType; -typedef struct { +typedef struct DigestParams { char nonce[300]; /**< Server specified nonce */ char algorithm[10]; /**< Server specified digest algorithm */ char qop[30]; /**< Quality of protection, containing the one @@ -52,7 +52,7 @@ typedef struct { * HTTP Authentication state structure. Must be zero-initialized * before used with the functions below. */ -typedef struct { +typedef struct HTTPAuthState { /** * The currently chosen auth type. */ diff --git a/libavformat/isom.h b/libavformat/isom.h index 370ba43a25..f6eba56220 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -42,18 +42,18 @@ int ff_mov_lang_to_iso639(unsigned code, char to[4]); * Here we just use what is needed to read the chunks */ -typedef struct { +typedef struct MOVStts { int count; int duration; } MOVStts; -typedef struct { +typedef struct MOVStsc { int first; int count; int id; } MOVStsc; -typedef struct { +typedef struct MOVDref { uint32_t type; char *path; char *dir; @@ -62,14 +62,14 @@ typedef struct { int16_t nlvl_to, nlvl_from; } MOVDref; -typedef struct { +typedef struct MOVAtom { uint32_t type; int64_t size; /* total size (excluding the size and type fields) */ } MOVAtom; struct MOVParseTableEntry; -typedef struct { +typedef struct MOVFragment { unsigned track_id; uint64_t base_data_offset; uint64_t moof_offset; @@ -79,7 +79,7 @@ typedef struct { unsigned flags; } MOVFragment; -typedef struct { +typedef struct MOVTrackExt { unsigned track_id; unsigned stsd_id; unsigned duration; @@ -87,7 +87,7 @@ typedef struct { unsigned flags; } MOVTrackExt; -typedef struct { +typedef struct MOVSbgp { unsigned int count; unsigned int index; } MOVSbgp; diff --git a/libavformat/mms.h b/libavformat/mms.h index cbfa79a838..57e3d7e18a 100644 --- a/libavformat/mms.h +++ b/libavformat/mms.h @@ -23,11 +23,11 @@ #include "url.h" -typedef struct { +typedef struct MMSStream { int id; }MMSStream; -typedef struct { +typedef struct MMSContext { URLContext *mms_hd; ///< TCP connection handle MMSStream *streams; diff --git a/libavformat/movenc.h b/libavformat/movenc.h index da6f19bbe0..7c87f6b14d 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -62,13 +62,13 @@ typedef struct HintSample { int own_data; } HintSample; -typedef struct { +typedef struct HintSampleQueue { int size; int len; HintSample *samples; } HintSampleQueue; -typedef struct { +typedef struct MOVFragmentInfo { int64_t offset; int64_t time; int64_t duration; diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h index eae9d46ad4..98c4b93736 100644 --- a/libavformat/mpegts.h +++ b/libavformat/mpegts.h @@ -65,7 +65,7 @@ int ff_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt, const uint8_t *buf, int len); void ff_mpegts_parse_close(MpegTSContext *ts); -typedef struct { +typedef struct SLConfigDescr { int use_au_start; int use_au_end; int use_rand_acc_pt; @@ -82,7 +82,7 @@ typedef struct { int packet_seq_num_len; } SLConfigDescr; -typedef struct { +typedef struct Mp4Descr { int es_id; int dec_config_descr_len; uint8_t *dec_config_descr; diff --git a/libavformat/mxf.h b/libavformat/mxf.h index ed3225b769..a91d53fdb2 100644 --- a/libavformat/mxf.h +++ b/libavformat/mxf.h @@ -55,13 +55,13 @@ enum MXFFrameLayout { SegmentedFrame, }; -typedef struct { +typedef struct KLVPacket { UID key; int64_t offset; uint64_t length; } KLVPacket; -typedef struct { +typedef struct MXFCodecUL { UID uid; unsigned matching_len; int id; diff --git a/libavformat/nut.h b/libavformat/nut.h index 39743db1b3..53b5ebc4db 100644 --- a/libavformat/nut.h +++ b/libavformat/nut.h @@ -53,14 +53,14 @@ typedef enum{ FLAG_INVALID =8192, ///<if set, frame_code is invalid } Flag; -typedef struct { +typedef struct Syncpoint { uint64_t pos; uint64_t back_ptr; // uint64_t global_key_pts; int64_t ts; } Syncpoint; -typedef struct { +typedef struct FrameCode { uint16_t flags; uint8_t stream_id; uint16_t size_mul; @@ -70,7 +70,7 @@ typedef struct { uint8_t header_idx; } FrameCode; -typedef struct { +typedef struct StreamContext { int last_flags; int skip_until_key_frame; int64_t last_pts; @@ -82,11 +82,11 @@ typedef struct { int64_t *keyframe_pts; } StreamContext; -typedef struct { +typedef struct ChapterContext { AVRational *time_base; } ChapterContext; -typedef struct { +typedef struct NUTContext { AVFormatContext *avf; // int written_packet_size; // int64_t packet_start; @@ -110,7 +110,7 @@ typedef struct { extern const AVCodecTag ff_nut_subtitle_tags[]; extern const AVCodecTag ff_nut_video_tags[]; -typedef struct { +typedef struct Dispositions { char str[9]; int flag; } Dispositions; diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index 521b2f5be4..3d7019024a 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -72,7 +72,7 @@ void ff_rtp_send_punch_packets(URLContext* rtp_handle); int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count); // these statistics are used for rtcp receiver reports... -typedef struct { +typedef struct RTPStatistics { uint16_t max_seq; ///< highest sequence number seen uint32_t cycles; ///< shifted count of sequence number cycles uint32_t base_seq; ///< base sequence number diff --git a/libavformat/swf.h b/libavformat/swf.h index 3c0c6076f2..5f0d486233 100644 --- a/libavformat/swf.h +++ b/libavformat/swf.h @@ -70,7 +70,7 @@ #undef NDEBUG #include <assert.h> -typedef struct { +typedef struct SWFContext { int64_t duration_pos; int64_t tag_pos; int64_t vframes_pos; diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index a53d30fb37..b67209423c 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -497,7 +497,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt) { int i; char header[MAX_FRAME_HEADER+1]; - int packet_size, width, height; + int packet_size, width, height, ret; AVStream *st = s->streams[0]; struct frame_attributes *s1 = s->priv_data; @@ -508,20 +508,28 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt) break; } } - if (i == MAX_FRAME_HEADER) - return -1; + if (s->pb->error) + return s->pb->error; + else if (s->pb->eof_reached) + return AVERROR_EOF; + else if (i == MAX_FRAME_HEADER) + return AVERROR_INVALIDDATA; + if (strncmp(header, Y4M_FRAME_MAGIC, strlen(Y4M_FRAME_MAGIC))) - return -1; + return AVERROR_INVALIDDATA; width = st->codec->width; height = st->codec->height; packet_size = avpicture_get_size(st->codec->pix_fmt, width, height); if (packet_size < 0) - return -1; + return packet_size; - if (av_get_packet(s->pb, pkt, packet_size) != packet_size) - return AVERROR(EIO); + ret = av_get_packet(s->pb, pkt, packet_size); + if (ret < 0) + return ret; + else if (ret != packet_size) + return s->pb->eof_reached ? AVERROR_EOF : AVERROR(EIO); if (st->codec->coded_frame) { st->codec->coded_frame->interlaced_frame = s1->interlaced_frame; diff --git a/libavresample/audio_data.c b/libavresample/audio_data.c index d624ad3796..199a68cb11 100644 --- a/libavresample/audio_data.c +++ b/libavresample/audio_data.c @@ -62,7 +62,7 @@ int ff_audio_data_set_channels(AudioData *a, int channels) return 0; } -int ff_audio_data_init(AudioData *a, void **src, int plane_size, int channels, +int ff_audio_data_init(AudioData *a, uint8_t **src, int plane_size, int channels, int nb_samples, enum AVSampleFormat sample_fmt, int read_only, const char *name) { diff --git a/libavresample/audio_data.h b/libavresample/audio_data.h index 4609ebc284..558e7e67ec 100644 --- a/libavresample/audio_data.h +++ b/libavresample/audio_data.h @@ -73,7 +73,7 @@ int ff_audio_data_set_channels(AudioData *a, int channels); * @param name name for debug logging (can be NULL) * @return 0 on success, negative AVERROR value on error */ -int ff_audio_data_init(AudioData *a, void **src, int plane_size, int channels, +int ff_audio_data_init(AudioData *a, uint8_t **src, int plane_size, int channels, int nb_samples, enum AVSampleFormat sample_fmt, int read_only, const char *name); diff --git a/libavresample/avresample-test.c b/libavresample/avresample-test.c index 0d4f2df37c..ab49e489cd 100644 --- a/libavresample/avresample-test.c +++ b/libavresample/avresample-test.c @@ -305,8 +305,8 @@ int main(int argc, char **argv) goto end; } - ret = avresample_convert(s, (void **)out_data, out_linesize, out_rate * 6, - (void **) in_data, in_linesize, in_rate * 6); + ret = avresample_convert(s, out_data, out_linesize, out_rate * 6, + in_data, in_linesize, in_rate * 6); if (ret < 0) { char errbuf[256]; av_strerror(ret, errbuf, sizeof(errbuf)); diff --git a/libavresample/avresample.h b/libavresample/avresample.h index b93aba5d73..ea93952e2e 100644 --- a/libavresample/avresample.h +++ b/libavresample/avresample.h @@ -234,8 +234,8 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta, * not including converted samples added to the internal * output FIFO */ -int avresample_convert(AVAudioResampleContext *avr, void **output, - int out_plane_size, int out_samples, void **input, +int avresample_convert(AVAudioResampleContext *avr, uint8_t **output, + int out_plane_size, int out_samples, uint8_t **input, int in_plane_size, int in_samples); /** @@ -287,6 +287,6 @@ int avresample_available(AVAudioResampleContext *avr); * @param nb_samples number of samples to read from the FIFO * @return the number of samples written to output */ -int avresample_read(AVAudioResampleContext *avr, void **output, int nb_samples); +int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples); #endif /* AVRESAMPLE_AVRESAMPLE_H */ diff --git a/libavresample/utils.c b/libavresample/utils.c index 81292930d4..2a0aacd4c0 100644 --- a/libavresample/utils.c +++ b/libavresample/utils.c @@ -247,8 +247,8 @@ static int handle_buffered_output(AVAudioResampleContext *avr, } int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, - void **output, int out_plane_size, - int out_samples, void **input, + uint8_t **output, int out_plane_size, + int out_samples, uint8_t **input, int in_plane_size, int in_samples) { AudioData input_buffer; @@ -410,11 +410,11 @@ int avresample_available(AVAudioResampleContext *avr) return av_audio_fifo_size(avr->out_fifo); } -int avresample_read(AVAudioResampleContext *avr, void **output, int nb_samples) +int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples) { if (!output) return av_audio_fifo_drain(avr->out_fifo, nb_samples); - return av_audio_fifo_read(avr->out_fifo, output, nb_samples); + return av_audio_fifo_read(avr->out_fifo, (void**)output, nb_samples); } unsigned avresample_version(void) diff --git a/libavresample/version.h b/libavresample/version.h index c4741e420e..53ba802d85 100644 --- a/libavresample/version.h +++ b/libavresample/version.h @@ -19,9 +19,9 @@ #ifndef AVRESAMPLE_VERSION_H #define AVRESAMPLE_VERSION_H -#define LIBAVRESAMPLE_VERSION_MAJOR 0 +#define LIBAVRESAMPLE_VERSION_MAJOR 1 #define LIBAVRESAMPLE_VERSION_MINOR 0 -#define LIBAVRESAMPLE_VERSION_MICRO 3 +#define LIBAVRESAMPLE_VERSION_MICRO 0 #define LIBAVRESAMPLE_VERSION_INT AV_VERSION_INT(LIBAVRESAMPLE_VERSION_MAJOR, \ LIBAVRESAMPLE_VERSION_MINOR, \ diff --git a/libavutil/dict.h b/libavutil/dict.h index 7f9924b128..fde3650184 100644 --- a/libavutil/dict.h +++ b/libavutil/dict.h @@ -74,7 +74,7 @@ #define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no delimiter is added, the strings are simply concatenated. */ -typedef struct { +typedef struct AVDictionaryEntry { char *key; char *value; } AVDictionaryEntry; diff --git a/libavutil/lfg.h b/libavutil/lfg.h index 854ffce737..ec90562cf2 100644 --- a/libavutil/lfg.h +++ b/libavutil/lfg.h @@ -22,7 +22,7 @@ #ifndef AVUTIL_LFG_H #define AVUTIL_LFG_H -typedef struct { +typedef struct AVLFG { unsigned int state[64]; int index; } AVLFG; diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c index c621866eed..e013f03c3b 100644 --- a/libswscale/ppc/swscale_altivec.c +++ b/libswscale/ppc/swscale_altivec.c @@ -32,78 +32,37 @@ #define vzero vec_splat_s32(0) -static inline void altivec_packIntArrayToCharArray(int *val, uint8_t *dest, - int dstW) +#define yuv2planeX_8(d1, d2, l1, src, x, perm, filter) do { \ + vector signed short l2 = vec_ld(((x) << 1) + 16, src); \ + vector signed short ls = vec_perm(l1, l2, perm); \ + vector signed int i1 = vec_mule(filter, ls); \ + vector signed int i2 = vec_mulo(filter, ls); \ + vector signed int vf1 = vec_mergeh(i1, i2); \ + vector signed int vf2 = vec_mergel(i1, i2); \ + d1 = vec_add(d1, vf1); \ + d2 = vec_add(d2, vf2); \ + l1 = l2; \ + } while (0) + +static void yuv2planeX_16_altivec(const int16_t *filter, int filterSize, + const int16_t **src, uint8_t *dest, + const uint8_t *dither, int offset, int x) { - register int i; + register int i, j; + DECLARE_ALIGNED(16, int, val)[16]; + vector signed int vo1, vo2, vo3, vo4; + vector unsigned short vs1, vs2; + vector unsigned char vf; vector unsigned int altivec_vectorShiftInt19 = vec_add(vec_splat_u32(10), vec_splat_u32(9)); - if ((uintptr_t)dest % 16) { - /* badly aligned store, we force store alignment */ - /* and will handle load misalignment on val w/ vec_perm */ - vector unsigned char perm1; - vector signed int v1; - for (i = 0; (i < dstW) && - (((uintptr_t)dest + i) % 16); i++) { - int t = val[i] >> 19; - dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t); - } - perm1 = vec_lvsl(i << 2, val); - v1 = vec_ld(i << 2, val); - for (; i < (dstW - 15); i += 16) { - int offset = i << 2; - vector signed int v2 = vec_ld(offset + 16, val); - vector signed int v3 = vec_ld(offset + 32, val); - vector signed int v4 = vec_ld(offset + 48, val); - vector signed int v5 = vec_ld(offset + 64, val); - vector signed int v12 = vec_perm(v1, v2, perm1); - vector signed int v23 = vec_perm(v2, v3, perm1); - vector signed int v34 = vec_perm(v3, v4, perm1); - vector signed int v45 = vec_perm(v4, v5, perm1); - - vector signed int vA = vec_sra(v12, altivec_vectorShiftInt19); - vector signed int vB = vec_sra(v23, altivec_vectorShiftInt19); - vector signed int vC = vec_sra(v34, altivec_vectorShiftInt19); - vector signed int vD = vec_sra(v45, altivec_vectorShiftInt19); - vector unsigned short vs1 = vec_packsu(vA, vB); - vector unsigned short vs2 = vec_packsu(vC, vD); - vector unsigned char vf = vec_packsu(vs1, vs2); - vec_st(vf, i, dest); - v1 = v5; - } - } else { // dest is properly aligned, great - for (i = 0; i < (dstW - 15); i += 16) { - int offset = i << 2; - vector signed int v1 = vec_ld(offset, val); - vector signed int v2 = vec_ld(offset + 16, val); - vector signed int v3 = vec_ld(offset + 32, val); - vector signed int v4 = vec_ld(offset + 48, val); - vector signed int v5 = vec_sra(v1, altivec_vectorShiftInt19); - vector signed int v6 = vec_sra(v2, altivec_vectorShiftInt19); - vector signed int v7 = vec_sra(v3, altivec_vectorShiftInt19); - vector signed int v8 = vec_sra(v4, altivec_vectorShiftInt19); - vector unsigned short vs1 = vec_packsu(v5, v6); - vector unsigned short vs2 = vec_packsu(v7, v8); - vector unsigned char vf = vec_packsu(vs1, vs2); - vec_st(vf, i, dest); - } - } - for (; i < dstW; i++) { - int t = val[i] >> 19; - dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t); - } -} -// FIXME remove the usage of scratch buffers. -static void yuv2planeX_altivec(const int16_t *filter, int filterSize, - const int16_t **src, uint8_t *dest, int dstW, - const uint8_t *dither, int offset) -{ - register int i, j; - DECLARE_ALIGNED(16, int, val)[dstW]; + for (i = 0; i < 16; i++) + val[i] = dither[(x + i + offset) & 7] << 12; - for (i = 0; i < dstW; i++) - val[i] = dither[(i + offset) & 7] << 12; + vo1 = vec_ld(0, val); + vo2 = vec_ld(16, val); + vo3 = vec_ld(32, val); + vo4 = vec_ld(48, val); for (j = 0; j < filterSize; j++) { vector signed short l1, vLumFilter = vec_ld(j << 1, filter); @@ -111,36 +70,51 @@ static void yuv2planeX_altivec(const int16_t *filter, int filterSize, vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0); vLumFilter = vec_splat(vLumFilter, 0); // lumFilter[j] is loaded 8 times in vLumFilter - perm = vec_lvsl(0, src[j]); - l1 = vec_ld(0, src[j]); + perm = vec_lvsl(x << 1, src[j]); + l1 = vec_ld(x << 1, src[j]); - for (i = 0; i < (dstW - 7); i += 8) { - int offset = i << 2; - vector signed short l2 = vec_ld((i << 1) + 16, src[j]); + yuv2planeX_8(vo1, vo2, l1, src[j], x, perm, vLumFilter); + yuv2planeX_8(vo3, vo4, l1, src[j], x + 8, perm, vLumFilter); + } - vector signed int v1 = vec_ld(offset, val); - vector signed int v2 = vec_ld(offset + 16, val); + vo1 = vec_sra(vo1, altivec_vectorShiftInt19); + vo2 = vec_sra(vo2, altivec_vectorShiftInt19); + vo3 = vec_sra(vo3, altivec_vectorShiftInt19); + vo4 = vec_sra(vo4, altivec_vectorShiftInt19); + vs1 = vec_packsu(vo1, vo2); + vs2 = vec_packsu(vo3, vo4); + vf = vec_packsu(vs1, vs2); + vec_st(vf, 0, dest); +} - vector signed short ls = vec_perm(l1, l2, perm); // lumSrc[j][i] ... lumSrc[j][i+7] +static inline void yuv2planeX_u(const int16_t *filter, int filterSize, + const int16_t **src, uint8_t *dest, int dstW, + const uint8_t *dither, int offset, int x) +{ + int i, j; - vector signed int i1 = vec_mule(vLumFilter, ls); - vector signed int i2 = vec_mulo(vLumFilter, ls); + for (i = x; i < dstW; i++) { + int t = dither[(i + offset) & 7] << 12; + for (j = 0; j < filterSize; j++) + t += src[j][i] * filter[j]; + dest[i] = av_clip_uint8(t >> 19); + } +} - vector signed int vf1 = vec_mergeh(i1, i2); - vector signed int vf2 = vec_mergel(i1, i2); // lumSrc[j][i] * lumFilter[j] ... lumSrc[j][i+7] * lumFilter[j] +static void yuv2planeX_altivec(const int16_t *filter, int filterSize, + const int16_t **src, uint8_t *dest, int dstW, + const uint8_t *dither, int offset) +{ + int dst_u = -(uintptr_t)dest & 15; + int i; - vector signed int vo1 = vec_add(v1, vf1); - vector signed int vo2 = vec_add(v2, vf2); + yuv2planeX_u(filter, filterSize, src, dest, dst_u, dither, offset, 0); - vec_st(vo1, offset, val); - vec_st(vo2, offset + 16, val); + for (i = dst_u; i < dstW - 15; i += 16) + yuv2planeX_16_altivec(filter, filterSize, src, dest + i, dither, + offset, i); - l1 = l2; - } - for (; i < dstW; i++) - val[i] += src[j][i] * filter[j]; - } - altivec_packIntArrayToCharArray(val, dest, dstW); + yuv2planeX_u(filter, filterSize, src, dest, dstW, dither, offset, i); } static void hScale_altivec_real(SwsContext *c, int16_t *dst, int dstW, diff --git a/libswscale/swscale.h b/libswscale/swscale.h index a9e803db43..71cb5d8108 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -115,13 +115,13 @@ const int *sws_getCoefficients(int colorspace); // when used for filters they must have an odd number of elements // coeffs cannot be shared between vectors -typedef struct { +typedef struct SwsVector { double *coeff; ///< pointer to the list of coefficients int length; ///< number of coefficients in the vector } SwsVector; // vectors can be shared -typedef struct { +typedef struct SwsFilter { SwsVector *lumH; SwsVector *lumV; SwsVector *chrH; |