diff options
58 files changed, 500 insertions, 387 deletions
@@ -218,7 +218,6 @@ static float audio_drift_threshold= 0.1; static int copy_ts= 0; static int copy_tb= 0; static int opt_shortest = 0; -static int video_global_header = 0; static char *vstats_filename; static FILE *vstats_file; static int opt_programid = 0; @@ -3555,15 +3554,10 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) if(video_codec_tag) video_enc->codec_tag= video_codec_tag; - if( (video_global_header&1) - || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){ + if(oc->oformat->flags & AVFMT_GLOBALHEADER) { video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } - if(video_global_header&2){ - video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; - avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER; - } if (video_stream_copy) { st->stream_copy = 1; @@ -4408,7 +4402,6 @@ static const OptionDef options[] = { { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" }, { "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" }, { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" }, - { "vglobal", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_global_header}, "video global header storage type", "" }, { "copyts", OPT_BOOL | OPT_EXPERT, {(void*)©_ts}, "copy timestamps" }, { "copytb", OPT_BOOL | OPT_EXPERT, {(void*)©_tb}, "copy input stream time base when stream copying" }, { "shortest", OPT_BOOL | OPT_EXPERT, {(void*)&opt_shortest}, "finish encoding within shortest input" }, // diff --git a/libavcodec/aac_tablegen.h b/libavcodec/aac_tablegen.h index 27fa0e7ba3..0c009ba48e 100644 --- a/libavcodec/aac_tablegen.h +++ b/libavcodec/aac_tablegen.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AAC_TABLEGEN_H -#define AAC_TABLEGEN_H +#ifndef AVCODEC_AAC_TABLEGEN_H +#define AVCODEC_AAC_TABLEGEN_H #include "aac_tablegen_decl.h" @@ -40,4 +40,4 @@ void ff_aac_tableinit(void) } #endif /* CONFIG_HARDCODED_TABLES */ -#endif /* AAC_TABLEGEN_H */ +#endif /* AVCODEC_AAC_TABLEGEN_H */ diff --git a/libavcodec/aac_tablegen_decl.h b/libavcodec/aac_tablegen_decl.h index 9a90a09b07..0d86e80bc2 100644 --- a/libavcodec/aac_tablegen_decl.h +++ b/libavcodec/aac_tablegen_decl.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AAC_TABLEGEN_DECL_H -#define AAC_TABLEGEN_DECL_H +#ifndef AVCODEC_AAC_TABLEGEN_DECL_H +#define AVCODEC_AAC_TABLEGEN_DECL_H #if CONFIG_HARDCODED_TABLES #define ff_aac_tableinit() @@ -31,4 +31,4 @@ void ff_aac_tableinit(void); extern float ff_aac_pow2sf_tab[428]; #endif /* CONFIG_HARDCODED_TABLES */ -#endif /* AAC_TABLEGEN_DECL_H */ +#endif /* AVCODEC_AAC_TABLEGEN_DECL_H */ diff --git a/libavcodec/amrwbdata.h b/libavcodec/amrwbdata.h index 36553d5a0f..1327b0237a 100644 --- a/libavcodec/amrwbdata.h +++ b/libavcodec/amrwbdata.h @@ -1887,4 +1887,4 @@ static const uint16_t cf_sizes_wb[] = { 40 /// SID/comfort noise frame }; -#endif +#endif /* AVCODEC_AMRWBDATA_H */ diff --git a/libavcodec/arm/asm-offsets.h b/libavcodec/arm/asm-offsets.h index 7f73534834..fe124ba702 100644 --- a/libavcodec/arm/asm-offsets.h +++ b/libavcodec/arm/asm-offsets.h @@ -36,4 +36,4 @@ #define H263_AIC 0xf0 #define INTER_SCANTAB_RASTER_END 0x138 -#endif +#endif /* AVCODEC_ARM_ASM_OFFSETS_H */ diff --git a/libavcodec/arm/dsputil_arm.h b/libavcodec/arm/dsputil_arm.h index 7f8579d507..b333c70226 100644 --- a/libavcodec/arm/dsputil_arm.h +++ b/libavcodec/arm/dsputil_arm.h @@ -30,4 +30,4 @@ void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx); void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx); void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx); -#endif +#endif /* AVCODEC_ARM_DSPUTIL_H */ diff --git a/libavcodec/arm/mpegvideo_arm.h b/libavcodec/arm/mpegvideo_arm.h index 4cc25fdd36..3549bb244b 100644 --- a/libavcodec/arm/mpegvideo_arm.h +++ b/libavcodec/arm/mpegvideo_arm.h @@ -24,4 +24,4 @@ void MPV_common_init_iwmmxt(MpegEncContext *s); void MPV_common_init_armv5te(MpegEncContext *s); -#endif +#endif /* AVCODEC_ARM_MPEGVIDEO_H */ diff --git a/libavcodec/arm/vp56_arith.h b/libavcodec/arm/vp56_arith.h index 9bcb466bdc..50a164d51c 100644 --- a/libavcodec/arm/vp56_arith.h +++ b/libavcodec/arm/vp56_arith.h @@ -89,4 +89,4 @@ static inline int vp56_rac_get_prob_branchy_armv6(VP56RangeCoder *c, int pr) #endif -#endif +#endif /* AVCODEC_ARM_VP56_ARITH_H */ diff --git a/libavcodec/arm/vp8.h b/libavcodec/arm/vp8.h index 90e7344b62..55193394c5 100644 --- a/libavcodec/arm/vp8.h +++ b/libavcodec/arm/vp8.h @@ -26,4 +26,4 @@ int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, DCTELEM block[16], int i, uint8_t *token_prob, int16_t qmul[2]); #endif -#endif +#endif /* AVCODEC_ARM_VP8_H */ diff --git a/libavcodec/cavsdsp.h b/libavcodec/cavsdsp.h index d3fae69e84..b41ad21bca 100644 --- a/libavcodec/cavsdsp.h +++ b/libavcodec/cavsdsp.h @@ -38,4 +38,4 @@ typedef struct CAVSDSPContext { void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx); void ff_cavsdsp_init_mmx(CAVSDSPContext* c, AVCodecContext *avctx); -#endif +#endif /* AVCODEC_CAVSDSP_H */ diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h index 930e513705..a9d34dc75d 100644 --- a/libavcodec/cbrt_tablegen.h +++ b/libavcodec/cbrt_tablegen.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef CBRT_TABLEGEN_H -#define CBRT_TABLEGEN_H +#ifndef AVCODEC_CBRT_TABLEGEN_H +#define AVCODEC_CBRT_TABLEGEN_H #include <stdint.h> #include <math.h> @@ -48,4 +48,4 @@ static void cbrt_tableinit(void) } #endif /* CONFIG_HARDCODED_TABLES */ -#endif /* CBRT_TABLEGEN_H */ +#endif /* AVCODEC_CBRT_TABLEGEN_H */ diff --git a/libavcodec/cga_data.h b/libavcodec/cga_data.h index 788b2b3911..998dccaefb 100644 --- a/libavcodec/cga_data.h +++ b/libavcodec/cga_data.h @@ -45,4 +45,4 @@ extern const uint32_t ff_ega_palette[64]; */ void ff_draw_pc_font(uint8_t *dst, int linesize, const uint8_t *font, int font_height, int ch, int fg, int bg); -#endif +#endif /* AVCODEC_CGA_DATA_H */ diff --git a/libavcodec/dct.h b/libavcodec/dct.h index ffc1d9aed2..bb17d75d0c 100644 --- a/libavcodec/dct.h +++ b/libavcodec/dct.h @@ -49,4 +49,4 @@ void ff_dct_end (DCTContext *s); void ff_dct_init_mmx(DCTContext *s); -#endif +#endif /* AVCODEC_DCT_H */ diff --git a/libavcodec/dctref.h b/libavcodec/dctref.h index adbaf689e2..be481f07b0 100644 --- a/libavcodec/dctref.h +++ b/libavcodec/dctref.h @@ -28,4 +28,4 @@ void ff_ref_fdct(DCTELEM *block); void ff_ref_idct(DCTELEM *block); void ff_ref_dct_init(void); -#endif +#endif /* AVCODEC_DCTREF_H */ diff --git a/libavcodec/dv_tablegen.h b/libavcodec/dv_tablegen.h index 47e8c362c1..678be73940 100644 --- a/libavcodec/dv_tablegen.h +++ b/libavcodec/dv_tablegen.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef DV_TABLEGEN_H -#define DV_TABLEGEN_H +#ifndef AVCODEC_DV_TABLEGEN_H +#define AVCODEC_DV_TABLEGEN_H #include <stdint.h> #include "dv_vlc_data.h" @@ -93,4 +93,4 @@ static void dv_vlc_map_tableinit(void) } #endif /* CONFIG_HARDCODED_TABLES */ -#endif /* DV_TABLEGEN_H */ +#endif /* AVCODEC_DV_TABLEGEN_H */ diff --git a/libavcodec/flv.h b/libavcodec/flv.h index eb10f22608..16bc88b663 100644 --- a/libavcodec/flv.h +++ b/libavcodec/flv.h @@ -30,5 +30,4 @@ void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run, in int ff_flv_decode_picture_header(MpegEncContext *s); void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last); -#endif - +#endif /* AVCODEC_FLV_H */ diff --git a/libavcodec/gsmdec_data.h b/libavcodec/gsmdec_data.h index 6b05bf6c97..bb4f159c60 100644 --- a/libavcodec/gsmdec_data.h +++ b/libavcodec/gsmdec_data.h @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef GSMDEC_DATA -#define GSMDEC_DATA +#ifndef AVCODEC_GSMDEC_DATA +#define AVCODEC_GSMDEC_DATA #include <stdint.h> @@ -44,4 +44,4 @@ typedef struct { extern const uint16_t ff_gsm_long_term_gain_tab[4]; extern const int16_t ff_gsm_dequant_tab[64][8]; -#endif +#endif /* AVCODEC_GSMDEC_DATA */ diff --git a/libavcodec/h263.h b/libavcodec/h263.h index 6c05565c70..b2b6613536 100644 --- a/libavcodec/h263.h +++ b/libavcodec/h263.h @@ -248,4 +248,5 @@ static inline void memsetw(short *tab, int val, int n) for(i=0;i<n;i++) tab[i] = val; } -#endif + +#endif /* AVCODEC_H263_H */ diff --git a/libavcodec/kbdwin.h b/libavcodec/kbdwin.h index e762105628..4b939756c1 100644 --- a/libavcodec/kbdwin.h +++ b/libavcodec/kbdwin.h @@ -32,4 +32,4 @@ */ void ff_kbd_window_init(float *window, float alpha, int n); -#endif +#endif /* AVCODEC_KBDWIN_H */ diff --git a/libavcodec/motionpixels_tablegen.h b/libavcodec/motionpixels_tablegen.h index 5d6df52af1..b56dec64a4 100644 --- a/libavcodec/motionpixels_tablegen.h +++ b/libavcodec/motionpixels_tablegen.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef MOTIONPIXELS_TABLEGEN_H -#define MOTIONPIXELS_TABLEGEN_H +#ifndef AVCODEC_MOTIONPIXELS_TABLEGEN_H +#define AVCODEC_MOTIONPIXELS_TABLEGEN_H #include <stdint.h> @@ -88,4 +88,4 @@ static void motionpixels_tableinit(void) } #endif /* CONFIG_HARDCODED_TABLES */ -#endif /* MOTIONPIXELS_TABLEGEN_H */ +#endif /* AVCODEC_MOTIONPIXELS_TABLEGEN_H */ diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h index 96db36683e..f1e6a4d172 100644 --- a/libavcodec/mpeg4video.h +++ b/libavcodec/mpeg4video.h @@ -196,4 +196,4 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *di return ret; } -#endif +#endif /* AVCODEC_MPEG4VIDEO_H */ diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h index 214959348a..291e40b9aa 100644 --- a/libavcodec/mpegaudio_tablegen.h +++ b/libavcodec/mpegaudio_tablegen.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef MPEGAUDIO_TABLEGEN_H -#define MPEGAUDIO_TABLEGEN_H +#ifndef AVCODEC_MPEGAUDIO_TABLEGEN_H +#define AVCODEC_MPEGAUDIO_TABLEGEN_H #include <stdint.h> #include <math.h> @@ -68,4 +68,4 @@ static void mpegaudio_tableinit(void) } #endif /* CONFIG_HARDCODED_TABLES */ -#endif /* MPEGAUDIO_TABLEGEN_H */ +#endif /* AVCODEC_MPEGAUDIO_TABLEGEN_H */ diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 872055c07b..4500739189 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -69,9 +69,9 @@ typedef struct MPADecodeContext { uint32_t free_format_next_header; GetBitContext gb; GetBitContext in_gb; - DECLARE_ALIGNED(16, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512 * 2]; + DECLARE_ALIGNED(32, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512 * 2]; int synth_buf_offset[MPA_MAX_CHANNELS]; - DECLARE_ALIGNED(16, INTFLOAT, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT]; + DECLARE_ALIGNED(32, INTFLOAT, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT]; INTFLOAT mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */ GranuleDef granules[2][2]; /* Used in Layer 3 */ #ifdef DEBUG diff --git a/libavcodec/mpegaudiodsp.h b/libavcodec/mpegaudiodsp.h index 597e2533f5..a47019cc4b 100644 --- a/libavcodec/mpegaudiodsp.h +++ b/libavcodec/mpegaudiodsp.h @@ -60,4 +60,4 @@ void ff_mpadsp_apply_window_fixed(int32_t *synth_buf, int32_t *window, int *dither_state, int16_t *samples, int incr); -#endif +#endif /* AVCODEC_MPEGAUDIODSP_H */ diff --git a/libavcodec/msgsmdec.h b/libavcodec/msgsmdec.h index fbf819a49c..3bfd1fd407 100644 --- a/libavcodec/msgsmdec.h +++ b/libavcodec/msgsmdec.h @@ -19,12 +19,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef MSGSMDEC_H -#define MSGSMDEC_H +#ifndef AVCODEC_MSGSMDEC_H +#define AVCODEC_MSGSMDEC_H #include "avcodec.h" int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples, const uint8_t *buf); -#endif +#endif /* AVCODEC_MSGSMDEC_H */ diff --git a/libavcodec/nellymoser.h b/libavcodec/nellymoser.h index 88d9aa6245..027fc7ed23 100644 --- a/libavcodec/nellymoser.h +++ b/libavcodec/nellymoser.h @@ -54,4 +54,4 @@ extern const int16_t ff_nelly_delta_table[32]; void ff_nelly_get_sample_bits(const float *buf, int *bits); -#endif +#endif /* AVCODEC_NELLYMOSER_H */ diff --git a/libavcodec/opt.h b/libavcodec/opt.h index e754bb93d8..70de27d192 100644 --- a/libavcodec/opt.h +++ b/libavcodec/opt.h @@ -13,4 +13,4 @@ #include "libavutil/opt.h" #endif -#endif +#endif /* AVCODEC_OPT_H */ diff --git a/libavcodec/pcm_tablegen.h b/libavcodec/pcm_tablegen.h index 3d641b05bb..1387210a58 100644 --- a/libavcodec/pcm_tablegen.h +++ b/libavcodec/pcm_tablegen.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef PCM_TABLEGEN_H -#define PCM_TABLEGEN_H +#ifndef AVCODEC_PCM_TABLEGEN_H +#define AVCODEC_PCM_TABLEGEN_H #include <stdint.h> #include "libavutil/attributes.h" @@ -116,4 +116,4 @@ static void pcm_ulaw_tableinit(void) } #endif /* CONFIG_HARDCODED_TABLES */ -#endif /* PCM_TABLEGEN_H */ +#endif /* AVCODEC_PCM_TABLEGEN_H */ diff --git a/libavcodec/qdm2_tablegen.h b/libavcodec/qdm2_tablegen.h index 6718f58b09..f215b15ffc 100644 --- a/libavcodec/qdm2_tablegen.h +++ b/libavcodec/qdm2_tablegen.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef QDM2_TABLEGEN_H -#define QDM2_TABLEGEN_H +#ifndef AVCODEC_QDM2_TABLEGEN_H +#define AVCODEC_QDM2_TABLEGEN_H #include <stdint.h> #include <math.h> @@ -99,4 +99,4 @@ static av_cold void init_noise_samples(void) { } #endif /* CONFIG_HARDCODED_TABLES */ -#endif /* QDM2_TABLEGEN_H */ +#endif /* AVCODEC_QDM2_TABLEGEN_H */ diff --git a/libavcodec/rdft.h b/libavcodec/rdft.h index cf50aba39c..5fb03232a1 100644 --- a/libavcodec/rdft.h +++ b/libavcodec/rdft.h @@ -71,4 +71,4 @@ void ff_rdft_end(RDFTContext *s); void ff_rdft_init_arm(RDFTContext *s); -#endif +#endif /* AVCODEC_RDFT_H */ diff --git a/libavcodec/sh4/dsputil_sh4.h b/libavcodec/sh4/dsputil_sh4.h index 2c1f77c770..2e554e7370 100644 --- a/libavcodec/sh4/dsputil_sh4.h +++ b/libavcodec/sh4/dsputil_sh4.h @@ -25,4 +25,4 @@ void idct_sh4(DCTELEM *block); void dsputil_init_align(DSPContext* c, AVCodecContext *avctx); -#endif +#endif /* AVCODEC_SH4_DSPUTIL_SH4_H */ diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h index 33f7d68b40..61135fd6a2 100644 --- a/libavcodec/sinewin.h +++ b/libavcodec/sinewin.h @@ -56,4 +56,4 @@ extern SINETABLE(4096); extern SINETABLE_CONST float * const ff_sine_windows[13]; -#endif +#endif /* AVCODEC_SINEWIN_H */ diff --git a/libavcodec/sinewin_tablegen.h b/libavcodec/sinewin_tablegen.h index 1c85d79f2f..f587595c21 100644 --- a/libavcodec/sinewin_tablegen.h +++ b/libavcodec/sinewin_tablegen.h @@ -20,6 +20,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef AVCODEC_SINEWIN_TABLEGEN_H +#define AVCODEC_SINEWIN_TABLEGEN_H + #include <assert.h> // do not use libavutil/libm.h since this is compiled both // for the host and the target and config.h is only valid for the target @@ -58,3 +61,5 @@ av_cold void ff_init_ff_sine_windows(int index) { ff_sine_window_init(ff_sine_windows[index], 1 << index); #endif } + +#endif /* AVCODEC_SINEWIN_TABLEGEN_H */ diff --git a/libavcodec/sparc/dsputil_vis.h b/libavcodec/sparc/dsputil_vis.h index 97ff965da2..e1cbcb49e3 100644 --- a/libavcodec/sparc/dsputil_vis.h +++ b/libavcodec/sparc/dsputil_vis.h @@ -26,4 +26,4 @@ void ff_simple_idct_put_vis(uint8_t *dest, int line_size, DCTELEM *data); void ff_simple_idct_add_vis(uint8_t *dest, int line_size, DCTELEM *data); void ff_simple_idct_vis(DCTELEM *data); -#endif +#endif /* AVCODEC_SPARC_DSPUTIL_VIS_H */ diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index a7e806540a..95c85fa0bb 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -819,21 +819,12 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx) avctx->pix_fmt = avctx->codec->pix_fmts[0]; if (!s->context_initialized) { - s->width = avctx->width; - s->height = avctx->height; h->chroma_qp[0] = h->chroma_qp[1] = 4; svq3->halfpel_flag = 1; svq3->thirdpel_flag = 1; svq3->unknown_flag = 0; - if (MPV_common_init(s) < 0) - return -1; - - h->b_stride = 4*s->mb_width; - - ff_h264_alloc_tables(h); - /* prowl for the "SEQH" marker in the extradata */ extradata = (unsigned char *)avctx->extradata; for (m = 0; m < avctx->extradata_size; m++) { @@ -920,6 +911,16 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx) #endif } } + + s->width = avctx->width; + s->height = avctx->height; + + if (MPV_common_init(s) < 0) + return -1; + + h->b_stride = 4*s->mb_width; + + ff_h264_alloc_tables(h); } return 0; diff --git a/libavcodec/targa.h b/libavcodec/targa.h index 5bc2a4407c..158a5ea0f4 100644 --- a/libavcodec/targa.h +++ b/libavcodec/targa.h @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef AVCODEC_TARGA_H +#define AVCODEC_TARGA_H + /** * @file * targa file common definitions @@ -34,3 +37,5 @@ enum TargaCompr { TGA_BW = 3, // black & white or grayscale TGA_RLE = 8, // flag pointing that data is RLE-coded }; + +#endif /* AVCODEC_TARGA_H */ diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h index d706b34aa6..468e28e8d5 100644 --- a/libavcodec/vp8.h +++ b/libavcodec/vp8.h @@ -239,4 +239,4 @@ typedef struct { AVFrame frames[5]; } VP8Context; -#endif +#endif /* AVCODEC_VP8_H */ diff --git a/libavcodec/vp8data.h b/libavcodec/vp8data.h index af9b0d9188..9ff21a1a97 100644 --- a/libavcodec/vp8data.h +++ b/libavcodec/vp8data.h @@ -685,4 +685,4 @@ static const uint8_t vp8_mv_default_prob[2][19] = { 128, 130, 130, 74, 148, 180, 203, 236, 254, 254 } }; -#endif +#endif /* AVCODEC_VP8DATA_H */ diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index 578ce04d77..b18153ebbd 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -1,6 +1,8 @@ OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp.o OBJS-$(CONFIG_TRUEHD_DECODER) += x86/mlpdsp.o +YASM-OBJS-$(CONFIG_DCT) += x86/dct32_sse.o + YASM-OBJS-FFT-$(HAVE_AMD3DNOW) += x86/fft_3dn.o YASM-OBJS-FFT-$(HAVE_AMD3DNOWEXT) += x86/fft_3dn2.o YASM-OBJS-FFT-$(HAVE_SSE) += x86/fft_sse.o @@ -55,4 +57,3 @@ OBJS-$(HAVE_MMX) += x86/dnxhd_mmx.o \ x86/mpegvideo_mmx.o \ x86/simple_idct_mmx.o \ -MMX-OBJS-$(CONFIG_DCT) += x86/dct32_sse.o diff --git a/libavcodec/x86/dct32_sse.asm b/libavcodec/x86/dct32_sse.asm new file mode 100644 index 0000000000..2e1176cd84 --- /dev/null +++ b/libavcodec/x86/dct32_sse.asm @@ -0,0 +1,391 @@ +;****************************************************************************** +;* 32 point SSE-optimized DCT transform +;* Copyright (c) 2010 Vitor Sessak +;* +;* 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 +;****************************************************************************** + +%include "x86inc.asm" +%include "config.asm" + +SECTION_RODATA 32 + +align 32 +ps_cos_vec: dd 0.500603, 0.505471, 0.515447, 0.531043 + dd 0.553104, 0.582935, 0.622504, 0.674808 + dd -10.190008, -3.407609, -2.057781, -1.484165 + dd -1.169440, -0.972568, -0.839350, -0.744536 + dd 0.502419, 0.522499, 0.566944, 0.646822 + dd 0.788155, 1.060678, 1.722447, 5.101149 + dd 0.509796, 0.601345, 0.899976, 2.562916 + dd 0.509796, 0.601345, 0.899976, 2.562916 + dd 1.000000, 1.000000, 1.306563, 0.541196 + dd 1.000000, 1.000000, 1.306563, 0.541196 + dd 1.000000, 0.707107, 1.000000, -0.707107 + dd 1.000000, 0.707107, 1.000000, -0.707107 + + +ps_p1p1m1m1: dd 0, 0, 0x80000000, 0x80000000, 0, 0, 0x80000000, 0x80000000 + +%macro BUTTERFLY_SSE 4 + movaps %4, %1 + subps %1, %2 + addps %2, %4 + mulps %1, %3 +%endmacro + +%macro BUTTERFLY_AVX 4 + vsubps %4, %1, %2 + vaddps %2, %2, %1 + vmulps %1, %4, %3 +%endmacro + +%macro BUTTERFLY0_SSE 5 + movaps %4, %1 + shufps %1, %1, %5 + xorps %4, %2 + addps %1, %4 + mulps %1, %3 +%endmacro + +%macro BUTTERFLY0_AVX 5 + vshufps %4, %1, %1, %5 + vxorps %1, %1, %2 + vaddps %4, %4, %1 + vmulps %1, %4, %3 +%endmacro + +%macro BUTTERFLY2 4 + BUTTERFLY0 %1, %2, %3, %4, 0x1b +%endmacro + +%macro BUTTERFLY3 4 + BUTTERFLY0 %1, %2, %3, %4, 0xb1 +%endmacro + +%macro PASS6_AND_PERMUTE 0 + mov tmpd, [outq+4] + movss m7, [outq+72] + addss m7, [outq+76] + movss m3, [outq+56] + addss m3, [outq+60] + addss m4, m3 + movss m2, [outq+52] + addss m2, m3 + movss m3, [outq+104] + addss m3, [outq+108] + addss m1, m3 + addss m5, m4 + movss [outq+ 16], m1 + movss m1, [outq+100] + addss m1, m3 + movss m3, [outq+40] + movss [outq+ 48], m1 + addss m3, [outq+44] + movss m1, [outq+100] + addss m4, m3 + addss m3, m2 + addss m1, [outq+108] + movss [outq+ 40], m3 + addss m2, [outq+36] + movss m3, [outq+8] + movss [outq+ 56], m2 + addss m3, [outq+12] + movss [outq+ 32], m3 + movss m3, [outq+80] + movss [outq+ 8], m5 + movss [outq+ 80], m1 + movss m2, [outq+52] + movss m5, [outq+120] + addss m5, [outq+124] + movss m1, [outq+64] + addss m2, [outq+60] + addss m0, m5 + addss m5, [outq+116] + mov [outq+64], tmpd + addss m6, m0 + addss m1, m6 + mov tmpd, [outq+12] + mov [outq+ 96], tmpd + movss [outq+ 4], m1 + movss m1, [outq+24] + movss [outq+ 24], m4 + movss m4, [outq+88] + addss m4, [outq+92] + addss m3, m4 + addss m4, [outq+84] + mov tmpd, [outq+108] + addss m1, [outq+28] + addss m0, m1 + addss m1, m5 + addss m6, m3 + addss m3, m0 + addss m0, m7 + addss m5, [outq+20] + addss m7, m1 + movss [outq+ 12], m6 + mov [outq+112], tmpd + movss m6, [outq+28] + movss [outq+ 28], m0 + movss m0, [outq+36] + movss [outq+ 36], m7 + addss m1, m4 + movss m7, [outq+116] + addss m0, m2 + addss m7, [outq+124] + movss [outq+ 72], m0 + movss m0, [outq+44] + addss m2, m0 + movss [outq+ 44], m1 + movss [outq+ 88], m2 + addss m0, [outq+60] + mov tmpd, [outq+60] + mov [outq+120], tmpd + movss [outq+104], m0 + addss m4, m5 + addss m5, [outq+68] + movss [outq+52], m4 + movss [outq+60], m5 + movss m4, [outq+68] + movss m5, [outq+20] + movss [outq+ 20], m3 + addss m5, m7 + addss m7, m6 + addss m4, m5 + movss m2, [outq+84] + addss m2, [outq+92] + addss m5, m2 + movss [outq+ 68], m4 + addss m2, m7 + movss m4, [outq+76] + movss [outq+ 84], m2 + movss [outq+ 76], m5 + addss m7, m4 + addss m6, [outq+124] + addss m4, m6 + addss m6, [outq+92] + movss [outq+100], m4 + movss [outq+108], m6 + movss m6, [outq+92] + movss [outq+92], m7 + addss m6, [outq+124] + movss [outq+116], m6 +%endmacro + +%define BUTTERFLY BUTTERFLY_AVX +%define BUTTERFLY0 BUTTERFLY0_AVX + +INIT_YMM +section .text align=16 +%ifdef HAVE_AVX +; void ff_dct32_float_avx(FFTSample *out, const FFTSample *in) +cglobal dct32_float_avx, 2,3,8, out, in, tmp + ; pass 1 + vmovaps m4, [inq+0] + vinsertf128 m5, m5, [inq+96], 1 + vinsertf128 m5, m5, [inq+112], 0 + vshufps m5, m5, m5, 0x1b + BUTTERFLY m4, m5, [ps_cos_vec], m6 + + vmovaps m2, [inq+64] + vinsertf128 m6, m6, [inq+32], 1 + vinsertf128 m6, m6, [inq+48], 0 + vshufps m6, m6, m6, 0x1b + BUTTERFLY m2, m6, [ps_cos_vec+32], m0 + + ; pass 2 + + BUTTERFLY m5, m6, [ps_cos_vec+64], m0 + BUTTERFLY m4, m2, [ps_cos_vec+64], m7 + + + ; pass 3 + vperm2f128 m3, m6, m4, 0x31 + vperm2f128 m1, m6, m4, 0x20 + vshufps m3, m3, m3, 0x1b + + BUTTERFLY m1, m3, [ps_cos_vec+96], m6 + + + vperm2f128 m4, m5, m2, 0x20 + vperm2f128 m5, m5, m2, 0x31 + vshufps m5, m5, m5, 0x1b + + BUTTERFLY m4, m5, [ps_cos_vec+96], m6 + + ; pass 4 + vmovaps m6, [ps_p1p1m1m1+0] + vmovaps m2, [ps_cos_vec+128] + + BUTTERFLY2 m5, m6, m2, m7 + BUTTERFLY2 m4, m6, m2, m7 + BUTTERFLY2 m1, m6, m2, m7 + BUTTERFLY2 m3, m6, m2, m7 + + + ; pass 5 + vshufps m6, m6, m6, 0xcc + vmovaps m2, [ps_cos_vec+160] + + BUTTERFLY3 m5, m6, m2, m7 + BUTTERFLY3 m4, m6, m2, m7 + BUTTERFLY3 m1, m6, m2, m7 + BUTTERFLY3 m3, m6, m2, m7 + + vperm2f128 m6, m3, m3, 0x31 + vmovaps [outq], m3 + + vextractf128 [outq+64], m5, 1 + vextractf128 [outq+32], m5, 0 + + vextractf128 [outq+80], m4, 1 + vextractf128 [outq+48], m4, 0 + + vperm2f128 m0, m1, m1, 0x31 + vmovaps [outq+96], m1 + + vzeroupper + + ; pass 6, no SIMD... +INIT_XMM + PASS6_AND_PERMUTE + RET +%endif + +%define BUTTERFLY BUTTERFLY_SSE +%define BUTTERFLY0 BUTTERFLY0_SSE + +INIT_XMM +; void ff_dct32_float_sse(FFTSample *out, const FFTSample *in) +cglobal dct32_float_sse, 2,3,8, out, in, tmp + ; pass 1 + + movaps m0, [inq+0] + movaps m1, [inq+112] + shufps m1, m1, 0x1b + BUTTERFLY m0, m1, [ps_cos_vec], m3 + + movaps m7, [inq+64] + movaps m4, [inq+48] + shufps m4, m4, 0x1b + BUTTERFLY m7, m4, [ps_cos_vec+32], m3 + + ; pass 2 + movaps m2, [ps_cos_vec+64] + BUTTERFLY m1, m4, m2, m3 + movaps [outq+48], m1 + movaps [outq+ 0], m4 + + ; pass 1 + movaps m1, [inq+16] + movaps m6, [inq+96] + shufps m6, m6, 0x1b + BUTTERFLY m1, m6, [ps_cos_vec+16], m3 + + movaps m4, [inq+80] + movaps m5, [inq+32] + shufps m5, m5, 0x1b + BUTTERFLY m4, m5, [ps_cos_vec+48], m3 + + ; pass 2 + BUTTERFLY m0, m7, m2, m3 + + movaps m2, [ps_cos_vec+80] + BUTTERFLY m6, m5, m2, m3 + + BUTTERFLY m1, m4, m2, m3 + + ; pass 3 + movaps m2, [ps_cos_vec+96] + shufps m1, m1, 0x1b + BUTTERFLY m0, m1, m2, m3 + movaps [outq+112], m0 + movaps [outq+ 96], m1 + + movaps m0, [outq+0] + shufps m5, m5, 0x1b + BUTTERFLY m0, m5, m2, m3 + + movaps m1, [outq+48] + shufps m6, m6, 0x1b + BUTTERFLY m1, m6, m2, m3 + movaps [outq+48], m1 + + shufps m4, m4, 0x1b + BUTTERFLY m7, m4, m2, m3 + + ; pass 4 + movaps m3, [ps_p1p1m1m1+0] + movaps m2, [ps_cos_vec+128] + + BUTTERFLY2 m5, m3, m2, m1 + + BUTTERFLY2 m0, m3, m2, m1 + movaps [outq+16], m0 + + BUTTERFLY2 m6, m3, m2, m1 + movaps [outq+32], m6 + + movaps m0, [outq+48] + BUTTERFLY2 m0, m3, m2, m1 + movaps [outq+48], m0 + + BUTTERFLY2 m4, m3, m2, m1 + + BUTTERFLY2 m7, m3, m2, m1 + + movaps m6, [outq+96] + BUTTERFLY2 m6, m3, m2, m1 + + movaps m0, [outq+112] + BUTTERFLY2 m0, m3, m2, m1 + + ; pass 5 + movaps m2, [ps_cos_vec+160] + shufps m3, m3, 0xcc + + BUTTERFLY3 m5, m3, m2, m1 + movaps [outq+0], m5 + + movaps m1, [outq+16] + BUTTERFLY3 m1, m3, m2, m5 + movaps [outq+96], m1 + + BUTTERFLY3 m4, m3, m2, m5 + movaps [outq+64], m4 + + BUTTERFLY3 m7, m3, m2, m5 + movaps [outq+80], m7 + + movaps m5, [outq+32] + BUTTERFLY3 m5, m3, m2, m7 + movaps [outq+32], m5 + + movaps m4, [outq+48] + BUTTERFLY3 m4, m3, m2, m7 + movaps [outq+48], m4 + + BUTTERFLY3 m6, m3, m2, m7 + movaps [outq+16], m6 + + BUTTERFLY3 m0, m3, m2, m7 + movaps [outq+112], m0 + + + ; pass 6, no SIMD... + PASS6_AND_PERMUTE + RET diff --git a/libavcodec/x86/dct32_sse.c b/libavcodec/x86/dct32_sse.c deleted file mode 100644 index 74338d6920..0000000000 --- a/libavcodec/x86/dct32_sse.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * 32 point SSE-optimized DCT transform - * Copyright (c) 2010 Vitor Sessak - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdint.h> - -#include "libavutil/x86_cpu.h" -#include "libavutil/mem.h" -#include "libavcodec/dsputil.h" -#include "fft.h" - -DECLARE_ALIGNED(16, static const float, b1)[] = { - 0.500603, 0.505471, 0.515447, 0.531043, - 0.553104, 0.582935, 0.622504, 0.674808, - -1.169440, -0.972568, -0.839350, -0.744536, - -10.190008, -3.407609, -2.057781, -1.484165, - 0.502419, 0.522499, 0.566944, 0.646822, - 0.788155, 1.060678, 1.722447, 5.101149, - 0.509796, 0.601345, 0.899976, 2.562916, - 1.000000, 1.000000, 1.306563, 0.541196, - 1.000000, 0.707107, 1.000000, -0.707107 -}; - -DECLARE_ALIGNED(16, static const int32_t, smask)[4] = { - 0, 0, 0x80000000, 0x80000000 -}; - -/* butterfly operator */ -#define BUTTERFLY(a,b,c,tmp) \ - "movaps %%" #a ", %%" #tmp " \n\t" \ - "subps %%" #b ", %%" #a " \n\t" \ - "addps %%" #tmp ", %%" #b " \n\t" \ - "mulps " #c ", %%" #a " \n\t" - -///* Same as BUTTERFLY when vectors a and b overlap */ -#define BUTTERFLY0(val, mask, cos, tmp, shuf) \ - "movaps %%" #val ", %%" #tmp " \n\t" \ - "shufps " #shuf ", %%" #val ",%%" #val " \n\t" \ - "xorps %%" #mask ", %%" #tmp " \n\t" /* flip signs */ \ - "addps %%" #tmp ", %%" #val " \n\t" \ - "mulps %%" #cos ", %%" #val " \n\t" - -#define BUTTERFLY2(val, mask, cos, tmp) BUTTERFLY0(val, mask, cos, tmp, $0x1b) -#define BUTTERFLY3(val, mask, cos, tmp) BUTTERFLY0(val, mask, cos, tmp, $0xb1) - -void ff_dct32_float_sse(FFTSample *out, const FFTSample *in) -{ - int32_t tmp1 = 0; - __asm__ volatile( - /* pass 1 */ - - "movaps (%4), %%xmm0 \n\t" - "movaps 112(%4), %%xmm1 \n\t" - "shufps $0x1b, %%xmm1, %%xmm1 \n\t" - BUTTERFLY(xmm0, xmm1, (%2), xmm3) - - "movaps 64(%4), %%xmm7 \n\t" - "movaps 48(%4), %%xmm4 \n\t" - "shufps $0x1b, %%xmm4, %%xmm4 \n\t" - BUTTERFLY(xmm7, xmm4, 48(%2), xmm3) - - - /* pass 2 */ - "movaps 64(%2), %%xmm2 \n\t" - BUTTERFLY(xmm1, xmm4, %%xmm2, xmm3) - "movaps %%xmm1, 48(%1) \n\t" - "movaps %%xmm4, (%1) \n\t" - - /* pass 1 */ - "movaps 16(%4), %%xmm1 \n\t" - "movaps 96(%4), %%xmm6 \n\t" - "shufps $0x1b, %%xmm6, %%xmm6 \n\t" - BUTTERFLY(xmm1, xmm6, 16(%2), xmm3) - - "movaps 80(%4), %%xmm4 \n\t" - "movaps 32(%4), %%xmm5 \n\t" - "shufps $0x1b, %%xmm5, %%xmm5 \n\t" - BUTTERFLY(xmm4, xmm5, 32(%2), xmm3) - - /* pass 2 */ - BUTTERFLY(xmm0, xmm7, %%xmm2, xmm3) - - "movaps 80(%2), %%xmm2 \n\t" - BUTTERFLY(xmm6, xmm5, %%xmm2, xmm3) - - BUTTERFLY(xmm1, xmm4, %%xmm2, xmm3) - - /* pass 3 */ - "movaps 96(%2), %%xmm2 \n\t" - "shufps $0x1b, %%xmm1, %%xmm1 \n\t" - BUTTERFLY(xmm0, xmm1, %%xmm2, xmm3) - "movaps %%xmm0, 112(%1) \n\t" - "movaps %%xmm1, 96(%1) \n\t" - - "movaps 0(%1), %%xmm0 \n\t" - "shufps $0x1b, %%xmm5, %%xmm5 \n\t" - BUTTERFLY(xmm0, xmm5, %%xmm2, xmm3) - - "movaps 48(%1), %%xmm1 \n\t" - "shufps $0x1b, %%xmm6, %%xmm6 \n\t" - BUTTERFLY(xmm1, xmm6, %%xmm2, xmm3) - "movaps %%xmm1, 48(%1) \n\t" - - "shufps $0x1b, %%xmm4, %%xmm4 \n\t" - BUTTERFLY(xmm7, xmm4, %%xmm2, xmm3) - - /* pass 4 */ - "movaps (%3), %%xmm3 \n\t" - "movaps 112(%2), %%xmm2 \n\t" - - BUTTERFLY2(xmm5, xmm3, xmm2, xmm1) - - BUTTERFLY2(xmm0, xmm3, xmm2, xmm1) - "movaps %%xmm0, 16(%1) \n\t" - - BUTTERFLY2(xmm6, xmm3, xmm2, xmm1) - "movaps %%xmm6, 32(%1) \n\t" - - "movaps 48(%1), %%xmm0 \n\t" - BUTTERFLY2(xmm0, xmm3, xmm2, xmm1) - "movaps %%xmm0, 48(%1) \n\t" - - BUTTERFLY2(xmm4, xmm3, xmm2, xmm1) - - BUTTERFLY2(xmm7, xmm3, xmm2, xmm1) - - "movaps 96(%1), %%xmm6 \n\t" - BUTTERFLY2(xmm6, xmm3, xmm2, xmm1) - - "movaps 112(%1), %%xmm0 \n\t" - BUTTERFLY2(xmm0, xmm3, xmm2, xmm1) - - /* pass 5 */ - "movaps 128(%2), %%xmm2 \n\t" - "shufps $0xCC, %%xmm3,%%xmm3 \n\t" - - BUTTERFLY3(xmm5, xmm3, xmm2, xmm1) - "movaps %%xmm5, (%1) \n\t" - - "movaps 16(%1), %%xmm1 \n\t" - BUTTERFLY3(xmm1, xmm3, xmm2, xmm5) - "movaps %%xmm1, 16(%1) \n\t" - - BUTTERFLY3(xmm4, xmm3, xmm2, xmm5) - "movaps %%xmm4, 64(%1) \n\t" - - BUTTERFLY3(xmm7, xmm3, xmm2, xmm5) - "movaps %%xmm7, 80(%1) \n\t" - - "movaps 32(%1), %%xmm5 \n\t" - BUTTERFLY3(xmm5, xmm3, xmm2, xmm7) - "movaps %%xmm5, 32(%1) \n\t" - - "movaps 48(%1), %%xmm4 \n\t" - BUTTERFLY3(xmm4, xmm3, xmm2, xmm7) - "movaps %%xmm4, 48(%1) \n\t" - - BUTTERFLY3(xmm6, xmm3, xmm2, xmm7) - "movaps %%xmm6, 96(%1) \n\t" - - BUTTERFLY3(xmm0, xmm3, xmm2, xmm7) - "movaps %%xmm0, 112(%1) \n\t" - - - /* pass 6, no SIMD... */ - "movss 56(%1), %%xmm3 \n\t" - "movl 4(%1), %0 \n\t" - "addss 60(%1), %%xmm3 \n\t" - "movss 72(%1), %%xmm7 \n\t" - "addss %%xmm3, %%xmm4 \n\t" - "movss 52(%1), %%xmm2 \n\t" - "addss %%xmm3, %%xmm2 \n\t" - "movss 24(%1), %%xmm3 \n\t" - "addss 28(%1), %%xmm3 \n\t" - "addss 76(%1), %%xmm7 \n\t" - "addss %%xmm3, %%xmm1 \n\t" - "addss %%xmm4, %%xmm5 \n\t" - "movss %%xmm1, 16(%1) \n\t" - "movss 20(%1), %%xmm1 \n\t" - "addss %%xmm3, %%xmm1 \n\t" - "movss 40(%1), %%xmm3 \n\t" - "movss %%xmm1, 48(%1) \n\t" - "addss 44(%1), %%xmm3 \n\t" - "movss 20(%1), %%xmm1 \n\t" - "addss %%xmm3, %%xmm4 \n\t" - "addss %%xmm2, %%xmm3 \n\t" - "addss 28(%1), %%xmm1 \n\t" - "movss %%xmm3, 40(%1) \n\t" - "addss 36(%1), %%xmm2 \n\t" - "movss 8(%1), %%xmm3 \n\t" - "movss %%xmm2, 56(%1) \n\t" - "addss 12(%1), %%xmm3 \n\t" - "movss %%xmm5, 8(%1) \n\t" - "movss %%xmm3, 32(%1) \n\t" - "movss 52(%1), %%xmm2 \n\t" - "movss 80(%1), %%xmm3 \n\t" - "movss 120(%1), %%xmm5 \n\t" - "movss %%xmm1, 80(%1) \n\t" - "movss %%xmm4, 24(%1) \n\t" - "addss 124(%1), %%xmm5 \n\t" - "movss 64(%1), %%xmm1 \n\t" - "addss 60(%1), %%xmm2 \n\t" - "addss %%xmm5, %%xmm0 \n\t" - "addss 116(%1), %%xmm5 \n\t" - "movl %0, 64(%1) \n\t" - "addss %%xmm0, %%xmm6 \n\t" - "addss %%xmm6, %%xmm1 \n\t" - "movl 12(%1), %0 \n\t" - "movss %%xmm1, 4(%1) \n\t" - "movss 88(%1), %%xmm1 \n\t" - "movl %0, 96(%1) \n\t" - "addss 92(%1), %%xmm1 \n\t" - "movss 104(%1), %%xmm4 \n\t" - "movl 28(%1), %0 \n\t" - "addss 108(%1), %%xmm4 \n\t" - "addss %%xmm4, %%xmm0 \n\t" - "addss %%xmm1, %%xmm3 \n\t" - "addss 84(%1), %%xmm1 \n\t" - "addss %%xmm5, %%xmm4 \n\t" - "addss %%xmm3, %%xmm6 \n\t" - "addss %%xmm0, %%xmm3 \n\t" - "addss %%xmm7, %%xmm0 \n\t" - "addss 100(%1), %%xmm5 \n\t" - "addss %%xmm4, %%xmm7 \n\t" - "movl %0, 112(%1) \n\t" - "movss %%xmm0, 28(%1) \n\t" - "movss 36(%1), %%xmm0 \n\t" - "movss %%xmm7, 36(%1) \n\t" - "addss %%xmm1, %%xmm4 \n\t" - "movss 116(%1), %%xmm7 \n\t" - "addss %%xmm2, %%xmm0 \n\t" - "addss 124(%1), %%xmm7 \n\t" - "movss %%xmm0, 72(%1) \n\t" - "movss 44(%1), %%xmm0 \n\t" - "movss %%xmm6, 12(%1) \n\t" - "movss %%xmm3, 20(%1) \n\t" - "addss %%xmm0, %%xmm2 \n\t" - "movss %%xmm4, 44(%1) \n\t" - "movss %%xmm2, 88(%1) \n\t" - "addss 60(%1), %%xmm0 \n\t" - "movl 60(%1), %0 \n\t" - "movl %0, 120(%1) \n\t" - "movss %%xmm0, 104(%1) \n\t" - "addss %%xmm5, %%xmm1 \n\t" - "addss 68(%1), %%xmm5 \n\t" - "movss %%xmm1, 52(%1) \n\t" - "movss %%xmm5, 60(%1) \n\t" - "movss 68(%1), %%xmm1 \n\t" - "movss 100(%1), %%xmm5 \n\t" - "addss %%xmm7, %%xmm5 \n\t" - "addss 108(%1), %%xmm7 \n\t" - "addss %%xmm5, %%xmm1 \n\t" - "movss 84(%1), %%xmm2 \n\t" - "addss 92(%1), %%xmm2 \n\t" - "addss %%xmm2, %%xmm5 \n\t" - "movss %%xmm1, 68(%1) \n\t" - "addss %%xmm7, %%xmm2 \n\t" - "movss 76(%1), %%xmm1 \n\t" - "movss %%xmm2, 84(%1) \n\t" - "movss %%xmm5, 76(%1) \n\t" - "movss 108(%1), %%xmm2 \n\t" - "addss %%xmm1, %%xmm7 \n\t" - "addss 124(%1), %%xmm2 \n\t" - "addss %%xmm2, %%xmm1 \n\t" - "addss 92(%1), %%xmm2 \n\t" - "movss %%xmm1, 100(%1) \n\t" - "movss %%xmm2, 108(%1) \n\t" - "movss 92(%1), %%xmm2 \n\t" - "movss %%xmm7, 92(%1) \n\t" - "addss 124(%1), %%xmm2 \n\t" - "movss %%xmm2, 116(%1) \n\t" - :"+&r"(tmp1) - :"r"(out), "r"(b1), "r"(smask), "r"(in) - :XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", - "%xmm4", "%xmm5", "%xmm6", "%xmm7",) - "memory" - ); -} - diff --git a/libavcodec/x86/fft.c b/libavcodec/x86/fft.c index 13f7ea6ec2..fb8329c011 100644 --- a/libavcodec/x86/fft.c +++ b/libavcodec/x86/fft.c @@ -57,7 +57,9 @@ av_cold void ff_fft_init_mmx(FFTContext *s) av_cold void ff_dct_init_mmx(DCTContext *s) { int has_vectors = av_get_cpu_flags(); - if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) + if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX) + s->dct32 = ff_dct32_float_avx; + else if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) s->dct32 = ff_dct32_float_sse; } #endif diff --git a/libavcodec/x86/fft.h b/libavcodec/x86/fft.h index 611db8508f..79064c27cd 100644 --- a/libavcodec/x86/fft.h +++ b/libavcodec/x86/fft.h @@ -35,5 +35,6 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input) void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample *input); void ff_imdct_half_avx(FFTContext *s, FFTSample *output, const FFTSample *input); void ff_dct32_float_sse(FFTSample *out, const FFTSample *in); +void ff_dct32_float_avx(FFTSample *out, const FFTSample *in); -#endif +#endif /* AVCODEC_X86_FFT_H */ diff --git a/libavcodec/xvmc_internal.h b/libavcodec/xvmc_internal.h index 9bb8909d28..04197cefae 100644 --- a/libavcodec/xvmc_internal.h +++ b/libavcodec/xvmc_internal.h @@ -18,8 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCODEC_INTERNAL_XVMC_H -#define AVCODEC_INTERNAL_XVMC_H +#ifndef AVCODEC_XVMC_INTERNAL_H +#define AVCODEC_XVMC_INTERNAL_H #include "avcodec.h" #include "mpegvideo.h" @@ -30,4 +30,4 @@ int ff_xvmc_field_start(MpegEncContext*s, AVCodecContext *avctx); void ff_xvmc_field_end(MpegEncContext *s); void ff_xvmc_decode_mb(MpegEncContext *s); -#endif /* AVCODEC_INTERNAL_XVMC_H */ +#endif /* AVCODEC_XVMC_INTERNAL_H */ diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 4502f3e54a..1c4b8d6cb8 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -861,4 +861,4 @@ static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index, &f->output_pads, &f->outputs, p); } -#endif /* AVFILTER_AVFILTER_H */ +#endif /* AVFILTER_AVFILTER_H */ diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h index 0140af0801..8013b46f5b 100644 --- a/libavfilter/avfiltergraph.h +++ b/libavfilter/avfiltergraph.h @@ -120,4 +120,4 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut *inputs, AVFilterInOut *outputs, AVClass *log_ctx); -#endif /* AVFILTER_AVFILTERGRAPH_H */ +#endif /* AVFILTER_AVFILTERGRAPH_H */ diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 159e979168..333dcbff81 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -58,4 +58,4 @@ int ff_avfilter_graph_config_formats(AVFilterGraph *graphctx, AVClass *log_ctx); /** default handler for freeing audio/video buffer when there are no references left */ void ff_avfilter_default_free_buffer(AVFilterBuffer *buf); -#endif /* AVFILTER_INTERNAL_H */ +#endif /* AVFILTER_INTERNAL_H */ diff --git a/libavformat/avio.h b/libavformat/avio.h index 07d127fd95..bf1ea30bb3 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -370,6 +370,7 @@ void avio_set_interrupt_cb(int (*interrupt_cb)(void)); * freed with av_free(). * * @param buffer Memory block for input/output operations via AVIOContext. + * The buffer must be allocated with av_malloc() and friends. * @param buffer_size The buffer size is very important for performance. * For protocols with fixed blocksize it should be set to this blocksize. * For others a typical size is a cache page, e.g. 4kb. diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 92528f2d18..4c80163d31 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -98,4 +98,4 @@ int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); */ int ffio_fdopen(AVIOContext **s, URLContext *h); -#endif // AVFORMAT_AVIO_INTERNAL_H +#endif /* AVFORMAT_AVIO_INTERNAL_H */ diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 9c17e8c6e6..aad0240d53 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -113,6 +113,8 @@ AVIOContext *avio_alloc_context( int64_t (*seek)(void *opaque, int64_t offset, int whence)) { AVIOContext *s = av_mallocz(sizeof(AVIOContext)); + if (!s) + return NULL; ffio_init_context(s, buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); return s; diff --git a/libavformat/ffmeta.h b/libavformat/ffmeta.h index f96dbb2efb..ae8778d614 100644 --- a/libavformat/ffmeta.h +++ b/libavformat/ffmeta.h @@ -19,11 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVFORMAT_META_H -#define AVFORMAT_META_H +#ifndef AVFORMAT_FFMETA_H +#define AVFORMAT_FFMETA_H #define ID_STRING ";FFMETADATA" #define ID_CHAPTER "[CHAPTER]" #define ID_STREAM "[STREAM]" -#endif /* AVFORMAT_META_H */ +#endif /* AVFORMAT_FFMETA_H */ diff --git a/libavformat/mms.h b/libavformat/mms.h index 788851e24f..0117089d24 100644 --- a/libavformat/mms.h +++ b/libavformat/mms.h @@ -60,4 +60,5 @@ typedef struct { int ff_mms_asf_header_parser(MMSContext * mms); int ff_mms_read_data(MMSContext *mms, uint8_t *buf, const int size); int ff_mms_read_header(MMSContext * mms, uint8_t * buf, const int size); -#endif + +#endif /* AVFORMAT_MMS_H */ diff --git a/libavformat/spdif.h b/libavformat/spdif.h index ac5be7c31a..4b11de20d1 100644 --- a/libavformat/spdif.h +++ b/libavformat/spdif.h @@ -19,6 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef AVFORMAT_SPDIF_H +#define AVFORMAT_SPDIF_H + #include <stdint.h> #define SYNCWORD1 0xF872 @@ -55,3 +58,5 @@ static const uint16_t spdif_mpeg_pkt_offset[2][3] = { }; void ff_spdif_bswap_buf16(uint16_t *dst, const uint16_t *src, int w); + +#endif /* AVFORMAT_SPDIF_H */ diff --git a/libavformat/url.h b/libavformat/url.h index 56366644aa..5ef6a21d7b 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -173,4 +173,4 @@ int ffurl_register_protocol(URLProtocol *protocol, int size); int ff_udp_set_remote_url(URLContext *h, const char *uri); int ff_udp_get_local_port(URLContext *h); -#endif //AVFORMAT_URL_H +#endif /* AVFORMAT_URL_H */ diff --git a/libavformat/version.h b/libavformat/version.h index dde8aa9dec..fb4577af5f 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -69,4 +69,4 @@ #define FF_API_SDP_CREATE (LIBAVFORMAT_VERSION_MAJOR < 54) #endif -#endif //AVFORMAT_VERSION_H +#endif /* AVFORMAT_VERSION_H */ diff --git a/libavutil/avassert.h b/libavutil/avassert.h index 8dd4878c11..e100d0bfdd 100644 --- a/libavutil/avassert.h +++ b/libavutil/avassert.h @@ -63,4 +63,4 @@ #define av_assert2(cond) ((void)0) #endif -#endif +#endif /* AVUTIL_AVASSERT_H */ diff --git a/libavutil/cpu.h b/libavutil/cpu.h index ff0c2e64ac..4ec3a27d7c 100644 --- a/libavutil/cpu.h +++ b/libavutil/cpu.h @@ -51,4 +51,4 @@ int ff_get_cpu_flags_arm(void); int ff_get_cpu_flags_ppc(void); int ff_get_cpu_flags_x86(void); -#endif /* AVUTIL_CPU_H */ +#endif /* AVUTIL_CPU_H */ diff --git a/libswscale/swscale.h b/libswscale/swscale.h index 406eec47f2..d026fb0bdc 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -187,6 +187,7 @@ void sws_freeContext(struct SwsContext *swsContext); * @return a pointer to an allocated context, or NULL in case of error * @note this function is to be removed after a saner alternative is * written + * @deprecated Use sws_getCachedContext() instead. */ struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, |