From 7181c4edee636beaf520344766ae5bd8a9d9d15a Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Fri, 27 Jan 2012 10:36:35 -0800 Subject: [PATCH 01/10] cosmetics: Remove extra newlines at EOF --- libavcodec/4xm.c | 1 - libavcodec/acelp_filters.c | 1 - libavcodec/allcodecs.c | 1 - libavcodec/alsdec.c | 1 - libavcodec/amrnbdata.h | 1 - libavcodec/atrac.c | 1 - libavcodec/aura.c | 1 - libavcodec/bitstream.c | 1 - libavcodec/cscd.c | 1 - libavcodec/dvdata.c | 1 - libavcodec/dxa.c | 1 - libavcodec/dxva2.c | 1 - libavcodec/dxva2_h264.c | 1 - libavcodec/dxva2_mpeg2.c | 1 - libavcodec/dxva2_vc1.c | 1 - libavcodec/escape124.c | 1 - libavcodec/fft.c | 1 - libavcodec/flashsvenc.c | 1 - libavcodec/h261.c | 1 - libavcodec/h261enc.c | 1 - libavcodec/h264_cavlc.c | 1 - libavcodec/h264_mp4toannexb_bsf.c | 1 - libavcodec/idcinvideo.c | 1 - libavcodec/imgconvert.c | 1 - libavcodec/intelh263dec.c | 1 - libavcodec/kbdwin.c | 1 - libavcodec/libvo-aacenc.c | 1 - libavcodec/libvo-amrwbenc.c | 1 - libavcodec/libxavs.c | 1 - libavcodec/libxvid_rc.c | 1 - libavcodec/mace.c | 1 - libavcodec/mathops.h | 1 - libavcodec/mdec.c | 1 - libavcodec/mlp_parser.h | 1 - libavcodec/mpeg12.c | 1 - libavcodec/mpeg4video.c | 1 - libavcodec/msrledec.c | 1 - libavcodec/msrledec.h | 1 - libavcodec/nellymoser.c | 1 - libavcodec/nellymoserdec.c | 1 - libavcodec/nuv.c | 1 - libavcodec/pcm_tablegen.c | 1 - libavcodec/psymodel.c | 1 - libavcodec/qtrle.c | 1 - libavcodec/ratecontrol.h | 1 - libavcodec/rl2.c | 1 - libavcodec/sgidec.c | 1 - libavcodec/smacker.c | 1 - libavcodec/snow.c | 1 - libavcodec/tscc.c | 1 - libavcodec/ulti.c | 1 - libavcodec/utvideo.c | 1 - libavcodec/vb.c | 1 - libavcodec/vmnc.c | 1 - libavcodec/vorbisdec.c | 1 - libavcodec/wma.c | 1 - libavcodec/xxan.c | 1 - libavcodec/zmbv.c | 1 - libavdevice/avdevice.h | 1 - libavfilter/defaults.c | 1 - libavfilter/formats.c | 1 - libavfilter/vf_aspect.c | 1 - libavfilter/vf_format.c | 1 - libavformat/aea.c | 1 - libavformat/avio.c | 1 - libavformat/httpauth.c | 1 - libavformat/id3v1.h | 1 - libavformat/iss.c | 1 - libavformat/lxfdec.c | 1 - libavformat/metadata.c | 1 - libavformat/movenchint.c | 1 - libavformat/network.c | 1 - libavformat/omadec.c | 1 - libavformat/rl2.c | 1 - libavformat/rtpdec_amr.c | 1 - libavformat/rtpdec_h263.c | 1 - libavformat/rtpenc_amr.c | 1 - libavformat/rtpenc_chain.c | 1 - libavformat/rtpenc_mpv.c | 2 -- libavformat/rtsp.c | 1 - libavformat/rtspenc.c | 1 - libavformat/sapdec.c | 1 - libavformat/sapenc.c | 1 - libavformat/sdp.c | 1 - libavformat/seek.c | 1 - libavutil/crc.h | 1 - libavutil/intfloat_readwrite.c | 1 - libavutil/md5.h | 1 - libavutil/mem.c | 1 - libswscale/rgb2rgb.c | 1 - libswscale/utils.c | 1 - 91 files changed, 92 deletions(-) diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 52edc9942e..da682dfb00 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -886,4 +886,3 @@ AVCodec ff_fourxm_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("4X Movie"), }; - diff --git a/libavcodec/acelp_filters.c b/libavcodec/acelp_filters.c index 04f6d4a5f9..16e2da1cc1 100644 --- a/libavcodec/acelp_filters.c +++ b/libavcodec/acelp_filters.c @@ -142,4 +142,3 @@ void ff_tilt_compensation(float *mem, float tilt, float *samples, int size) samples[0] -= tilt * *mem; *mem = new_tilt_mem; } - diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index fe1ee5c4b0..cda71e0a1a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -432,4 +432,3 @@ void avcodec_register_all(void) REGISTER_BSF (REMOVE_EXTRADATA, remove_extradata); REGISTER_BSF (TEXT2MOVSUB, text2movsub); } - diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index dc4961c9ba..2948a48b5c 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1755,4 +1755,3 @@ AVCodec ff_als_decoder = { .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Audio Lossless Coding (ALS)"), }; - diff --git a/libavcodec/amrnbdata.h b/libavcodec/amrnbdata.h index d6d1f34562..26ff7fb40e 100644 --- a/libavcodec/amrnbdata.h +++ b/libavcodec/amrnbdata.h @@ -1669,4 +1669,3 @@ static const float highpass_poles[2] = { -1.933105469, 0.935913085 }; static const float highpass_gain = 0.939819335; #endif /* AVCODEC_AMRNBDATA_H */ - diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index 2c39aade22..da6cd305fb 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -117,4 +117,3 @@ void atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float /* Update the delay buffer. */ memcpy(delayBuf, temp + nIn*2, 46*sizeof(float)); } - diff --git a/libavcodec/aura.c b/libavcodec/aura.c index f1fdb5ccec..6052a65acf 100644 --- a/libavcodec/aura.c +++ b/libavcodec/aura.c @@ -133,4 +133,3 @@ AVCodec ff_aura2_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Auravision Aura 2"), }; - diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c index 14e392f34d..8ac4802961 100644 --- a/libavcodec/bitstream.c +++ b/libavcodec/bitstream.c @@ -322,4 +322,3 @@ void free_vlc(VLC *vlc) { av_freep(&vlc->table); } - diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c index 00921bc47d..43f0e5e7d5 100644 --- a/libavcodec/cscd.c +++ b/libavcodec/cscd.c @@ -265,4 +265,3 @@ AVCodec ff_cscd_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("CamStudio"), }; - diff --git a/libavcodec/dvdata.c b/libavcodec/dvdata.c index 3a135a9ac7..a2d89399f5 100644 --- a/libavcodec/dvdata.c +++ b/libavcodec/dvdata.c @@ -282,4 +282,3 @@ const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec) return NULL; } - diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c index 97b912a61a..d196f49486 100644 --- a/libavcodec/dxa.c +++ b/libavcodec/dxa.c @@ -328,4 +328,3 @@ AVCodec ff_dxa_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Feeble Files/ScummVM DXA"), }; - diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c index e56a64594e..d7d893c457 100644 --- a/libavcodec/dxva2.c +++ b/libavcodec/dxva2.c @@ -151,4 +151,3 @@ end: ff_draw_horiz_band(s, 0, s->avctx->height); return result; } - diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c index 9608ecb8e6..ffe71a9656 100644 --- a/libavcodec/dxva2_h264.c +++ b/libavcodec/dxva2_h264.c @@ -448,4 +448,3 @@ AVHWAccel ff_h264_dxva2_hwaccel = { .end_frame = end_frame, .priv_data_size = sizeof(struct dxva2_picture_context), }; - diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c index 2e77cd1bd8..b20b3d79f4 100644 --- a/libavcodec/dxva2_mpeg2.c +++ b/libavcodec/dxva2_mpeg2.c @@ -270,4 +270,3 @@ AVHWAccel ff_mpeg2_dxva2_hwaccel = { .end_frame = end_frame, .priv_data_size = sizeof(struct dxva2_picture_context), }; - diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index 22ad4598ae..64447ad87a 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -286,4 +286,3 @@ AVHWAccel ff_vc1_dxva2_hwaccel = { .end_frame = end_frame, .priv_data_size = sizeof(struct dxva2_picture_context), }; - diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c index f6d7c8268e..4ca4ff3951 100644 --- a/libavcodec/escape124.c +++ b/libavcodec/escape124.c @@ -374,4 +374,3 @@ AVCodec ff_escape124_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Escape 124"), }; - diff --git a/libavcodec/fft.c b/libavcodec/fft.c index aa34b34152..1e31dde163 100644 --- a/libavcodec/fft.c +++ b/libavcodec/fft.c @@ -350,4 +350,3 @@ static void ff_fft_calc_c(FFTContext *s, FFTComplex *z) { fft_dispatch[s->nbits-2](z); } - diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index 81aa5b6bfb..669badc6ce 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -286,4 +286,3 @@ AVCodec ff_flashsv_encoder = { .pix_fmts = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video"), }; - diff --git a/libavcodec/h261.c b/libavcodec/h261.c index eab36402ee..9555613f6b 100644 --- a/libavcodec/h261.c +++ b/libavcodec/h261.c @@ -51,4 +51,3 @@ void ff_h261_loop_filter(MpegEncContext *s){ s->dsp.h261_loop_filter(dest_cb, uvlinesize); s->dsp.h261_loop_filter(dest_cr, uvlinesize); } - diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c index c758ec09d5..1072d9eabc 100644 --- a/libavcodec/h261enc.c +++ b/libavcodec/h261enc.c @@ -332,4 +332,3 @@ AVCodec ff_h261_encoder = { .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("H.261"), }; - diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index db74602f66..fdb7ab5709 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -1187,4 +1187,3 @@ decode_intra_mb: return 0; } - diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index bc49b146ab..eceebebecb 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -190,4 +190,3 @@ AVBitStreamFilter ff_h264_mp4toannexb_bsf = { sizeof(H264BSFContext), h264_mp4toannexb_filter, }; - diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c index 8ae15eb67f..e1b0e2e3e9 100644 --- a/libavcodec/idcinvideo.c +++ b/libavcodec/idcinvideo.c @@ -264,4 +264,3 @@ AVCodec ff_idcin_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("id Quake II CIN video"), }; - diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 07b7edfd52..d90254ca76 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -1013,4 +1013,3 @@ int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, emms_c(); return 0; } - diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c index 8347c79021..bedfabff02 100644 --- a/libavcodec/intelh263dec.c +++ b/libavcodec/intelh263dec.c @@ -136,4 +136,3 @@ AVCodec ff_h263i_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Intel H.263"), .pix_fmts= ff_pixfmt_list_420, }; - diff --git a/libavcodec/kbdwin.c b/libavcodec/kbdwin.c index c2c1c59040..3b590b38ef 100644 --- a/libavcodec/kbdwin.c +++ b/libavcodec/kbdwin.c @@ -45,4 +45,3 @@ av_cold void ff_kbd_window_init(float *window, float alpha, int n) for (i = 0; i < n; i++) window[i] = sqrt(local_window[i] / sum); } - diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index 647971a892..280ba27ef9 100644 --- a/libavcodec/libvo-aacenc.c +++ b/libavcodec/libvo-aacenc.c @@ -126,4 +126,3 @@ AVCodec ff_libvo_aacenc_encoder = { .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn AAC"), }; - diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index f39317e1de..5214ee6d2e 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -130,4 +130,3 @@ AVCodec ff_libvo_amrwbenc_encoder = { "(AMR) Wide-Band"), .priv_class = &class, }; - diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index f65be72b3c..8587eae99b 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -384,4 +384,3 @@ AVCodec ff_libxavs_encoder = { .priv_class = &class, .defaults = xavs_defaults, }; - diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c index b4bc715aea..2386ce3cc6 100644 --- a/libavcodec/libxvid_rc.c +++ b/libavcodec/libxvid_rc.c @@ -145,4 +145,3 @@ void ff_xvid_rate_control_uninit(MpegEncContext *s){ xvid_plugin_2pass2(s->rc_context.non_lavc_opaque, XVID_PLG_DESTROY, &xvid_plg_destroy, NULL); } - diff --git a/libavcodec/mace.c b/libavcodec/mace.c index 792d71d072..e22bc3976a 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -310,4 +310,3 @@ AVCodec ff_mace6_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 6:1"), }; - diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h index 45b1ecf1ae..d6eb98ddac 100644 --- a/libavcodec/mathops.h +++ b/libavcodec/mathops.h @@ -179,4 +179,3 @@ if ((y) < (x)) {\ #endif #endif /* AVCODEC_MATHOPS_H */ - diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index 3741549b22..a4e2020317 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -276,4 +276,3 @@ AVCodec ff_mdec_decoder = { .long_name= NULL_IF_CONFIG_SMALL("Sony PlayStation MDEC (Motion DECoder)"), .init_thread_copy= ONLY_IF_THREADS_ENABLED(decode_init_thread_copy) }; - diff --git a/libavcodec/mlp_parser.h b/libavcodec/mlp_parser.h index 940ba838f3..35bb312f17 100644 --- a/libavcodec/mlp_parser.h +++ b/libavcodec/mlp_parser.h @@ -56,4 +56,3 @@ typedef struct MLPHeaderInfo int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb); #endif /* AVCODEC_MLP_PARSER_H */ - diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index d79cf705ac..4515ef04a7 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -2587,4 +2587,3 @@ AVCodec ff_mpeg1_vdpau_decoder = { .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video (VDPAU acceleration)"), }; #endif - diff --git a/libavcodec/mpeg4video.c b/libavcodec/mpeg4video.c index 130e9b2050..d7c928df03 100644 --- a/libavcodec/mpeg4video.c +++ b/libavcodec/mpeg4video.c @@ -168,4 +168,3 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my){ return MB_TYPE_DIRECT2 | MB_TYPE_16x16 | MB_TYPE_L0L1; //Note see prev line } } - diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c index 5e33a59280..4714772a20 100644 --- a/libavcodec/msrledec.c +++ b/libavcodec/msrledec.c @@ -256,4 +256,3 @@ int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic, int depth, return -1; } } - diff --git a/libavcodec/msrledec.h b/libavcodec/msrledec.h index 5bde35a1a2..ca5d936977 100644 --- a/libavcodec/msrledec.h +++ b/libavcodec/msrledec.h @@ -37,4 +37,3 @@ int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic, int depth, const uint8_t* data, int data_size); #endif /* AVCODEC_MSRLEDEC_H */ - diff --git a/libavcodec/nellymoser.c b/libavcodec/nellymoser.c index cbcc4f941b..195e2e80ae 100644 --- a/libavcodec/nellymoser.c +++ b/libavcodec/nellymoser.c @@ -223,4 +223,3 @@ void ff_nelly_get_sample_bits(const float *buf, int *bits) bits[i] = 0; } } - diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 69c1b86f5e..9d5e1c73dd 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -227,4 +227,3 @@ AVCodec ff_nellymoser_decoder = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, }; - diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c index 94962b5843..5f601db66e 100644 --- a/libavcodec/nuv.c +++ b/libavcodec/nuv.c @@ -283,4 +283,3 @@ AVCodec ff_nuv_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("NuppelVideo/RTJPEG"), }; - diff --git a/libavcodec/pcm_tablegen.c b/libavcodec/pcm_tablegen.c index 8a9bcb6fb1..7b4bc8c6c9 100644 --- a/libavcodec/pcm_tablegen.c +++ b/libavcodec/pcm_tablegen.c @@ -37,4 +37,3 @@ int main(void) return 0; } - diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c index 316076a904..5d6c32eda1 100644 --- a/libavcodec/psymodel.c +++ b/libavcodec/psymodel.c @@ -134,4 +134,3 @@ av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx) av_freep(&ctx->fstate); av_free(ctx); } - diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index 0c74798226..e96e2788c9 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -545,4 +545,3 @@ AVCodec ff_qtrle_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"), }; - diff --git a/libavcodec/ratecontrol.h b/libavcodec/ratecontrol.h index 6cd4a18010..c0e05ccf18 100644 --- a/libavcodec/ratecontrol.h +++ b/libavcodec/ratecontrol.h @@ -102,4 +102,3 @@ void ff_xvid_rate_control_uninit(struct MpegEncContext *s); float ff_xvid_rate_estimate_qscale(struct MpegEncContext *s, int dry_run); #endif /* AVCODEC_RATECONTROL_H */ - diff --git a/libavcodec/rl2.c b/libavcodec/rl2.c index 7e3bd9cdde..ace3b0cca5 100644 --- a/libavcodec/rl2.c +++ b/libavcodec/rl2.c @@ -229,4 +229,3 @@ AVCodec ff_rl2_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("RL2 video"), }; - diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index dfa00ed79f..580cf81a20 100644 --- a/libavcodec/sgidec.c +++ b/libavcodec/sgidec.c @@ -268,4 +268,3 @@ AVCodec ff_sgi_decoder = { .decode = decode_frame, .long_name = NULL_IF_CONFIG_SMALL("SGI image"), }; - diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 44331f267b..192466280d 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -752,4 +752,3 @@ AVCodec ff_smackaud_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Smacker audio"), }; - diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 905e02ad70..d7f33b4eae 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -650,4 +650,3 @@ av_cold void ff_snow_common_end(SnowContext *s) if (s->current_picture.data[0]) s->avctx->release_buffer(s->avctx, &s->current_picture); } - diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c index ccf1048c9b..3e3073d3cd 100644 --- a/libavcodec/tscc.c +++ b/libavcodec/tscc.c @@ -209,4 +209,3 @@ AVCodec ff_tscc_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Capture Codec"), }; - diff --git a/libavcodec/ulti.c b/libavcodec/ulti.c index 62bab3c38d..96f13e430a 100644 --- a/libavcodec/ulti.c +++ b/libavcodec/ulti.c @@ -428,4 +428,3 @@ AVCodec ff_ulti_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("IBM UltiMotion"), }; - diff --git a/libavcodec/utvideo.c b/libavcodec/utvideo.c index 89854c277c..413a3743c5 100644 --- a/libavcodec/utvideo.c +++ b/libavcodec/utvideo.c @@ -578,4 +578,3 @@ AVCodec ff_utvideo_decoder = { .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS, .long_name = NULL_IF_CONFIG_SMALL("Ut Video"), }; - diff --git a/libavcodec/vb.c b/libavcodec/vb.c index a1052ef95f..e7002a1def 100644 --- a/libavcodec/vb.c +++ b/libavcodec/vb.c @@ -276,4 +276,3 @@ AVCodec ff_vb_decoder = { .decode = decode_frame, .long_name = NULL_IF_CONFIG_SMALL("Beam Software VB"), }; - diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c index a72c507c3c..8cc78fa4c0 100644 --- a/libavcodec/vmnc.c +++ b/libavcodec/vmnc.c @@ -519,4 +519,3 @@ AVCodec ff_vmnc_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("VMware Screen Codec / VMware Video"), }; - diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index bb69fed254..2f1477ffb0 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -1713,4 +1713,3 @@ AVCodec ff_vorbis_decoder = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, }; - diff --git a/libavcodec/wma.c b/libavcodec/wma.c index d82fde7b18..4eaf6fcc1e 100644 --- a/libavcodec/wma.c +++ b/libavcodec/wma.c @@ -525,4 +525,3 @@ int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb, return 0; } - diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c index 58c80c05fa..4659d34972 100644 --- a/libavcodec/xxan.c +++ b/libavcodec/xxan.c @@ -425,4 +425,3 @@ AVCodec ff_xan_wc4_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"), }; - diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index a36a844b1f..2345eb36b5 100644 --- a/libavcodec/zmbv.c +++ b/libavcodec/zmbv.c @@ -672,4 +672,3 @@ AVCodec ff_zmbv_decoder = { .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"), }; - diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h index 553604137c..c010af2fb9 100644 --- a/libavdevice/avdevice.h +++ b/libavdevice/avdevice.h @@ -77,4 +77,3 @@ const char *avdevice_license(void); void avdevice_register_all(void); #endif /* AVDEVICE_AVDEVICE_H */ - diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c index 4c7e878f9e..6d9003de37 100644 --- a/libavfilter/defaults.c +++ b/libavfilter/defaults.c @@ -297,4 +297,3 @@ AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms, return avfilter_get_audio_buffer(link->dst->outputs[0], perms, sample_fmt, size, channel_layout, packed); } - diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 8c5041a8fe..78b027762a 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -181,4 +181,3 @@ void avfilter_formats_changeref(AVFilterFormats **oldref, *oldref = NULL; } } - diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c index b43aa86bea..9db29c70f5 100644 --- a/libavfilter/vf_aspect.c +++ b/libavfilter/vf_aspect.c @@ -143,4 +143,3 @@ AVFilter avfilter_vf_setsar = { { .name = NULL}}, }; #endif /* CONFIG_SETSAR_FILTER */ - diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c index 0b0d094169..9c1e0d4266 100644 --- a/libavfilter/vf_format.c +++ b/libavfilter/vf_format.c @@ -144,4 +144,3 @@ AVFilter avfilter_vf_noformat = { { .name = NULL}}, }; #endif /* CONFIG_NOFORMAT_FILTER */ - diff --git a/libavformat/aea.c b/libavformat/aea.c index b62e56030a..25450a4841 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -103,4 +103,3 @@ AVInputFormat ff_aea_demuxer = { .flags= AVFMT_GENERIC_INDEX, .extensions = "aea", }; - diff --git a/libavformat/avio.c b/libavformat/avio.c index 067f2958e0..ba25abea38 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -352,4 +352,3 @@ int ff_check_interrupt(AVIOInterruptCB *cb) return ret; return 0; } - diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c index c8b8ace3c2..4383585db1 100644 --- a/libavformat/httpauth.c +++ b/libavformat/httpauth.c @@ -265,4 +265,3 @@ char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth, } return authstr; } - diff --git a/libavformat/id3v1.h b/libavformat/id3v1.h index 4842f16f53..71070736f1 100644 --- a/libavformat/id3v1.h +++ b/libavformat/id3v1.h @@ -39,4 +39,3 @@ extern const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1]; void ff_id3v1_read(AVFormatContext *s); #endif /* AVFORMAT_ID3V1_H */ - diff --git a/libavformat/iss.c b/libavformat/iss.c index c2ba1f0eb5..8c297f8ffb 100644 --- a/libavformat/iss.c +++ b/libavformat/iss.c @@ -130,4 +130,3 @@ AVInputFormat ff_iss_demuxer = { .read_header = iss_read_header, .read_packet = iss_read_packet, }; - diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index ee12dfbb98..bc95a0820e 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -346,4 +346,3 @@ AVInputFormat ff_lxf_demuxer = { .read_packet = lxf_read_packet, .codec_tag = (const AVCodecTag* const []){lxf_tags, 0}, }; - diff --git a/libavformat/metadata.c b/libavformat/metadata.c index 7f28314698..77fb298217 100644 --- a/libavformat/metadata.c +++ b/libavformat/metadata.c @@ -68,4 +68,3 @@ void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv, for (i=0; inb_programs; i++) ff_metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv); } - diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index 9f5e621a88..c2025c0af9 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -459,4 +459,3 @@ void ff_mov_close_hinting(MOVTrack *track) { } avformat_free_context(rtp_ctx); } - diff --git a/libavformat/network.c b/libavformat/network.c index bfc34c72a7..432084faa4 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -182,4 +182,3 @@ int ff_is_multicast_address(struct sockaddr *addr) return 0; } - diff --git a/libavformat/omadec.c b/libavformat/omadec.c index 3bff790a56..60b42fa9a9 100644 --- a/libavformat/omadec.c +++ b/libavformat/omadec.c @@ -442,4 +442,3 @@ AVInputFormat ff_oma_demuxer = { .extensions = "oma,omg,aa3", .codec_tag = (const AVCodecTag* const []){ff_oma_codec_tags, 0}, }; - diff --git a/libavformat/rl2.c b/libavformat/rl2.c index 8ec76ff921..bb0a961a66 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -294,4 +294,3 @@ AVInputFormat ff_rl2_demuxer = { .read_packet = rl2_read_packet, .read_seek = rl2_read_seek, }; - diff --git a/libavformat/rtpdec_amr.c b/libavformat/rtpdec_amr.c index b7ff3aa05e..9f5ab26aa9 100644 --- a/libavformat/rtpdec_amr.c +++ b/libavformat/rtpdec_amr.c @@ -205,4 +205,3 @@ RTPDynamicProtocolHandler ff_amr_wb_dynamic_handler = { .free = amr_free_context, .parse_packet = amr_handle_packet, }; - diff --git a/libavformat/rtpdec_h263.c b/libavformat/rtpdec_h263.c index 0fb1b25eb0..af71ed63c3 100644 --- a/libavformat/rtpdec_h263.c +++ b/libavformat/rtpdec_h263.c @@ -105,4 +105,3 @@ RTPDynamicProtocolHandler ff_h263_2000_dynamic_handler = { .codec_id = CODEC_ID_H263, .parse_packet = h263_handle_packet, }; - diff --git a/libavformat/rtpenc_amr.c b/libavformat/rtpenc_amr.c index 4da7ace32a..73da8c8251 100644 --- a/libavformat/rtpenc_amr.c +++ b/libavformat/rtpenc_amr.c @@ -63,4 +63,3 @@ void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size) memcpy(s->buf_ptr, buff, size); s->buf_ptr += size; } - diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index b9d1690008..16b38d69e5 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -83,4 +83,3 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, return rtpctx; } - diff --git a/libavformat/rtpenc_mpv.c b/libavformat/rtpenc_mpv.c index 1c67f9593b..37dedc33f5 100644 --- a/libavformat/rtpenc_mpv.c +++ b/libavformat/rtpenc_mpv.c @@ -115,5 +115,3 @@ void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size) end_of_slice = 0; } } - - diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index c47cb0e4f1..cdcda7eb67 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1997,4 +1997,3 @@ AVInputFormat ff_rtp_demuxer = { .priv_class = &rtp_demuxer_class }; #endif /* CONFIG_RTP_DEMUXER */ - diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index e4e79cad03..86621cf19d 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -245,4 +245,3 @@ AVOutputFormat ff_rtsp_muxer = { .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER, .priv_class = &rtsp_muxer_class, }; - diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index aa176c73ee..f0f592e1fb 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -236,4 +236,3 @@ AVInputFormat ff_sap_demuxer = { .read_close = sap_read_close, .flags = AVFMT_NOFILE, }; - diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index d8ec465afa..dbd7bdb7b9 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -261,4 +261,3 @@ AVOutputFormat ff_sap_muxer = { .write_trailer = sap_write_close, .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER, }; - diff --git a/libavformat/sdp.c b/libavformat/sdp.c index ddf28bd7ab..5e0bf72050 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -642,4 +642,3 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des { } #endif - diff --git a/libavformat/seek.c b/libavformat/seek.c index 6c4286bb8e..e64021dc78 100644 --- a/libavformat/seek.c +++ b/libavformat/seek.c @@ -516,4 +516,3 @@ void ff_free_parser_state(AVFormatContext *s, AVParserState *state) av_free(state->stream_states); av_free(state); } - diff --git a/libavutil/crc.h b/libavutil/crc.h index a934119413..5c25607bbc 100644 --- a/libavutil/crc.h +++ b/libavutil/crc.h @@ -41,4 +41,3 @@ const AVCRC *av_crc_get_table(AVCRCId crc_id); uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure; #endif /* AVUTIL_CRC_H */ - diff --git a/libavutil/intfloat_readwrite.c b/libavutil/intfloat_readwrite.c index 4c8de7b7a8..68385635ef 100644 --- a/libavutil/intfloat_readwrite.c +++ b/libavutil/intfloat_readwrite.c @@ -95,4 +95,3 @@ AVExtFloat av_dbl2ext(double d){ ext.exponent[0] |= 0x80; return ext; } - diff --git a/libavutil/md5.h b/libavutil/md5.h index 1412ee2401..c5b858a24b 100644 --- a/libavutil/md5.h +++ b/libavutil/md5.h @@ -43,4 +43,3 @@ void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); */ #endif /* AVUTIL_MD5_H */ - diff --git a/libavutil/mem.c b/libavutil/mem.c index 27bb30b8ef..b6230cf0e3 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -170,4 +170,3 @@ char *av_strdup(const char *s) } return ptr; } - diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index 47b06f53fc..5ae0703a7f 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -346,4 +346,3 @@ DEFINE_SHUFFLE_BYTES(0, 3, 2, 1) DEFINE_SHUFFLE_BYTES(1, 2, 3, 0) DEFINE_SHUFFLE_BYTES(3, 0, 1, 2) DEFINE_SHUFFLE_BYTES(3, 2, 1, 0) - diff --git a/libswscale/utils.c b/libswscale/utils.c index b49f924244..15039ce1f0 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1533,4 +1533,3 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, } return context; } - From aac46e088d67a390489af686b846dea4987d8ffb Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 12 Jan 2012 00:17:45 +0000 Subject: [PATCH 02/10] aacsbr: move some simdable loops to function pointers This prepares for assembly optimisations by moving the most time-consuming loops to functions called through pointers in a new context. Signed-off-by: Mans Rullgard --- libavcodec/Makefile | 3 +- libavcodec/aacsbr.c | 183 ++++++++----------------------- libavcodec/aacsbrdata.h | 2 +- libavcodec/sbr.h | 2 + libavcodec/sbrdsp.c | 237 ++++++++++++++++++++++++++++++++++++++++ libavcodec/sbrdsp.h | 47 ++++++++ 6 files changed, 337 insertions(+), 137 deletions(-) create mode 100644 libavcodec/sbrdsp.c create mode 100644 libavcodec/sbrdsp.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ef2aa9626f..27f8546644 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -52,7 +52,8 @@ OBJS-$(CONFIG_VDPAU) += vdpau.o OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \ - aacadtsdec.o mpeg4audio.o kbdwin.o + aacadtsdec.o mpeg4audio.o kbdwin.o \ + sbrdsp.o OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \ aacpsy.o aactab.o \ psymodel.o iirfilter.o \ diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 0bfcabb06b..01601b035c 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -32,6 +32,7 @@ #include "aacsbrdata.h" #include "fft.h" #include "aacps.h" +#include "sbrdsp.h" #include "libavutil/libm.h" #include @@ -140,6 +141,7 @@ av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr) ff_mdct_init(&sbr->mdct, 7, 1, 1.0 / (64 * mdct_scale)); ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0 * mdct_scale); ff_ps_ctx_init(&sbr->ps); + ff_sbrdsp_init(&sbr->dsp); } av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr) @@ -1139,33 +1141,21 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) * @param x pointer to the beginning of the first sample window * @param W array of complex-valued samples split into subbands */ -static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, float *x, +static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, + SBRDSPContext *sbrdsp, const float *in, float *x, float z[320], float W[2][32][32][2]) { - int i, k; + int i; memcpy(W[0], W[1], sizeof(W[0])); memcpy(x , x+1024, (320-32)*sizeof(x[0])); memcpy(x+288, in, 1024*sizeof(x[0])); for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames // are not supported dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320); - for (k = 0; k < 64; k++) { - float f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256]; - z[k] = f; - } - //Shuffle to IMDCT - z[64] = z[0]; - for (k = 1; k < 32; k++) { - z[64+2*k-1] = z[ k]; - z[64+2*k ] = -z[64-k]; - } - z[64+63] = z[32]; - + sbrdsp->sum64x5(z); + sbrdsp->qmf_pre_shuffle(z); mdct->imdct_half(mdct, z, z+64); - for (k = 0; k < 32; k++) { - W[1][i][k][0] = -z[63-k]; - W[1][i][k][1] = z[k]; - } + sbrdsp->qmf_post_shuffle(W[1][i], z); x += 32; } } @@ -1175,6 +1165,7 @@ static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, * (14496-3 sp04 p206) */ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct, + SBRDSPContext *sbrdsp, float *out, float X[2][38][64], float mdct_buf[2][64], float *v0, int *v_off, const unsigned int div) @@ -1198,20 +1189,12 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct, X[0][i][32+n] = X[1][i][31-n]; } mdct->imdct_half(mdct, mdct_buf[0], X[0][i]); - for (n = 0; n < 32; n++) { - v[ n] = mdct_buf[0][63 - 2*n]; - v[63 - n] = -mdct_buf[0][62 - 2*n]; - } + sbrdsp->qmf_deint_neg(v, mdct_buf[0]); } else { - for (n = 1; n < 64; n+=2) { - X[1][i][n] = -X[1][i][n]; - } + sbrdsp->neg_odd_64(X[1][i]); mdct->imdct_half(mdct, mdct_buf[0], X[0][i]); mdct->imdct_half(mdct, mdct_buf[1], X[1][i]); - for (n = 0; n < 64; n++) { - v[ n] = -mdct_buf[0][63 - n] + mdct_buf[1][ n ]; - v[127 - n] = mdct_buf[0][63 - n] + mdct_buf[1][ n ]; - } + sbrdsp->qmf_deint_bfly(v, mdct_buf[1], mdct_buf[0]); } dsp->vector_fmul_add(out, v , sbr_qmf_window , zero64, 64 >> div); dsp->vector_fmul_add(out, v + ( 192 >> div), sbr_qmf_window + ( 64 >> div), out , 64 >> div); @@ -1227,45 +1210,19 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct, } } -static void autocorrelate(const float x[40][2], float phi[3][2][2], int lag) -{ - int i; - float real_sum = 0.0f; - float imag_sum = 0.0f; - if (lag) { - for (i = 1; i < 38; i++) { - real_sum += x[i][0] * x[i+lag][0] + x[i][1] * x[i+lag][1]; - imag_sum += x[i][0] * x[i+lag][1] - x[i][1] * x[i+lag][0]; - } - phi[2-lag][1][0] = real_sum + x[ 0][0] * x[lag][0] + x[ 0][1] * x[lag][1]; - phi[2-lag][1][1] = imag_sum + x[ 0][0] * x[lag][1] - x[ 0][1] * x[lag][0]; - if (lag == 1) { - phi[0][0][0] = real_sum + x[38][0] * x[39][0] + x[38][1] * x[39][1]; - phi[0][0][1] = imag_sum + x[38][0] * x[39][1] - x[38][1] * x[39][0]; - } - } else { - for (i = 1; i < 38; i++) { - real_sum += x[i][0] * x[i][0] + x[i][1] * x[i][1]; - } - phi[2][1][0] = real_sum + x[ 0][0] * x[ 0][0] + x[ 0][1] * x[ 0][1]; - phi[1][0][0] = real_sum + x[38][0] * x[38][0] + x[38][1] * x[38][1]; - } -} - /** High Frequency Generation (14496-3 sp04 p214+) and Inverse Filtering * (14496-3 sp04 p214) * Warning: This routine does not seem numerically stable. */ -static void sbr_hf_inverse_filter(float (*alpha0)[2], float (*alpha1)[2], +static void sbr_hf_inverse_filter(SBRDSPContext *dsp, + float (*alpha0)[2], float (*alpha1)[2], const float X_low[32][40][2], int k0) { int k; for (k = 0; k < k0; k++) { float phi[3][2][2], dk; - autocorrelate(X_low[k], phi, 0); - autocorrelate(X_low[k], phi, 1); - autocorrelate(X_low[k], phi, 2); + dsp->autocorrelate(X_low[k], phi); dk = phi[2][1][0] * phi[1][0][0] - (phi[1][1][0] * phi[1][1][0] + phi[1][1][1] * phi[1][1][1]) / 1.000001f; @@ -1361,12 +1318,11 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr, const float bw_array[5], const uint8_t *t_env, int bs_num_env) { - int i, j, x; + int j, x; int g = 0; int k = sbr->kx[1]; for (j = 0; j < sbr->num_patches; j++) { for (x = 0; x < sbr->patch_num_subbands[j]; x++, k++) { - float alpha[4]; const int p = sbr->patch_start_subband[j] + x; while (g <= sbr->n_q && k >= sbr->f_tablenoise[g]) g++; @@ -1378,26 +1334,10 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr, return -1; } - alpha[0] = alpha1[p][0] * bw_array[g] * bw_array[g]; - alpha[1] = alpha1[p][1] * bw_array[g] * bw_array[g]; - alpha[2] = alpha0[p][0] * bw_array[g]; - alpha[3] = alpha0[p][1] * bw_array[g]; - - for (i = 2 * t_env[0]; i < 2 * t_env[bs_num_env]; i++) { - const int idx = i + ENVELOPE_ADJUSTMENT_OFFSET; - X_high[k][idx][0] = - X_low[p][idx - 2][0] * alpha[0] - - X_low[p][idx - 2][1] * alpha[1] + - X_low[p][idx - 1][0] * alpha[2] - - X_low[p][idx - 1][1] * alpha[3] + - X_low[p][idx][0]; - X_high[k][idx][1] = - X_low[p][idx - 2][1] * alpha[0] + - X_low[p][idx - 2][0] * alpha[1] + - X_low[p][idx - 1][1] * alpha[2] + - X_low[p][idx - 1][0] * alpha[3] + - X_low[p][idx][1]; - } + sbr->dsp.hf_gen(X_high[k] + ENVELOPE_ADJUSTMENT_OFFSET, + X_low[p] + ENVELOPE_ADJUSTMENT_OFFSET, + alpha0[p], alpha1[p], bw_array[g], + 2 * t_env[0], 2 * t_env[bs_num_env]); } } if (k < sbr->m[1] + sbr->kx[1]) @@ -1497,7 +1437,8 @@ static void sbr_mapping(AACContext *ac, SpectralBandReplication *sbr, static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2], SpectralBandReplication *sbr, SBRData *ch_data) { - int e, i, m; + int e, m; + int kx1 = sbr->kx[1]; if (sbr->bs_interpol_freq) { for (e = 0; e < ch_data->bs_num_env; e++) { @@ -1506,12 +1447,7 @@ static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2], int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; for (m = 0; m < sbr->m[1]; m++) { - float sum = 0.0f; - - for (i = ilb; i < iub; i++) { - sum += X_high[m + sbr->kx[1]][i][0] * X_high[m + sbr->kx[1]][i][0] + - X_high[m + sbr->kx[1]][i][1] * X_high[m + sbr->kx[1]][i][1]; - } + float sum = sbr->dsp.sum_square(X_high[m+kx1] + ilb, iub - ilb); e_curr[e][m] = sum * recip_env_size; } } @@ -1529,14 +1465,11 @@ static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2], const int den = env_size * (table[p + 1] - table[p]); for (k = table[p]; k < table[p + 1]; k++) { - for (i = ilb; i < iub; i++) { - sum += X_high[k][i][0] * X_high[k][i][0] + - X_high[k][i][1] * X_high[k][i][1]; - } + sum += sbr->dsp.sum_square(X_high[k] + ilb, iub - ilb); } sum /= den; for (k = table[p]; k < table[p + 1]; k++) { - e_curr[e][k - sbr->kx[1]] = sum; + e_curr[e][k - kx1] = sum; } } } @@ -1647,55 +1580,34 @@ static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2] for (e = 0; e < ch_data->bs_num_env; e++) { for (i = 2 * ch_data->t_env[e]; i < 2 * ch_data->t_env[e + 1]; i++) { int phi_sign = (1 - 2*(kx & 1)); + float g_filt_tab[48], *g_filt; + float q_filt_tab[48], *q_filt; if (h_SL && e != e_a[0] && e != e_a[1]) { + g_filt = g_filt_tab; + q_filt = q_filt_tab; for (m = 0; m < m_max; m++) { const int idx1 = i + h_SL; - float g_filt = 0.0f; - for (j = 0; j <= h_SL; j++) - g_filt += g_temp[idx1 - j][m] * h_smooth[j]; - Y[1][i][m + kx][0] = - X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][0] * g_filt; - Y[1][i][m + kx][1] = - X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][1] * g_filt; + g_filt[m] = 0.0f; + q_filt[m] = 0.0f; + for (j = 0; j <= h_SL; j++) { + g_filt[m] += g_temp[idx1 - j][m] * h_smooth[j]; + q_filt[m] += q_temp[idx1 - j][m] * h_smooth[j]; + } } } else { - for (m = 0; m < m_max; m++) { - const float g_filt = g_temp[i + h_SL][m]; - Y[1][i][m + kx][0] = - X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][0] * g_filt; - Y[1][i][m + kx][1] = - X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][1] * g_filt; - } + g_filt = g_temp[i + h_SL]; + q_filt = q_temp[i]; } + sbr->dsp.hf_g_filt(Y[1][i] + kx, X_high + kx, g_filt, m_max, + i + ENVELOPE_ADJUSTMENT_OFFSET); + if (e != e_a[0] && e != e_a[1]) { - for (m = 0; m < m_max; m++) { - indexnoise = (indexnoise + 1) & 0x1ff; - if (sbr->s_m[e][m]) { - Y[1][i][m + kx][0] += - sbr->s_m[e][m] * phi[0][indexsine]; - Y[1][i][m + kx][1] += - sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign); - } else { - float q_filt; - if (h_SL) { - const int idx1 = i + h_SL; - q_filt = 0.0f; - for (j = 0; j <= h_SL; j++) - q_filt += q_temp[idx1 - j][m] * h_smooth[j]; - } else { - q_filt = q_temp[i][m]; - } - Y[1][i][m + kx][0] += - q_filt * sbr_noise_table[indexnoise][0]; - Y[1][i][m + kx][1] += - q_filt * sbr_noise_table[indexnoise][1]; - } - phi_sign = -phi_sign; - } + sbr->dsp.hf_apply_noise[indexsine](Y[1][i] + kx, sbr->s_m[e], + q_filt, indexnoise, + kx, m_max); } else { - indexnoise = (indexnoise + m_max) & 0x1ff; for (m = 0; m < m_max; m++) { Y[1][i][m + kx][0] += sbr->s_m[e][m] * phi[0][indexsine]; @@ -1704,6 +1616,7 @@ static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2] phi_sign = -phi_sign; } } + indexnoise = (indexnoise + m_max) & 0x1ff; indexsine = (indexsine + 1) & 3; } } @@ -1723,12 +1636,12 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, } for (ch = 0; ch < nch; ch++) { /* decode channel */ - sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, ch ? R : L, sbr->data[ch].analysis_filterbank_samples, + sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, &sbr->dsp, ch ? R : L, sbr->data[ch].analysis_filterbank_samples, (float*)sbr->qmf_filter_scratch, sbr->data[ch].W); sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W); if (sbr->start) { - sbr_hf_inverse_filter(sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]); + sbr_hf_inverse_filter(&sbr->dsp, sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]); sbr_chirp(sbr, &sbr->data[ch]); sbr_hf_gen(ac, sbr, sbr->X_high, sbr->X_low, sbr->alpha0, sbr->alpha1, sbr->data[ch].bw_array, sbr->data[ch].t_env, @@ -1755,12 +1668,12 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, nch = 2; } - sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, L, sbr->X[0], sbr->qmf_filter_scratch, + sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, &sbr->dsp, L, sbr->X[0], sbr->qmf_filter_scratch, sbr->data[0].synthesis_filterbank_samples, &sbr->data[0].synthesis_filterbank_samples_offset, downsampled); if (nch == 2) - sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, R, sbr->X[1], sbr->qmf_filter_scratch, + sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, &sbr->dsp, R, sbr->X[1], sbr->qmf_filter_scratch, sbr->data[1].synthesis_filterbank_samples, &sbr->data[1].synthesis_filterbank_samples_offset, downsampled); diff --git a/libavcodec/aacsbrdata.h b/libavcodec/aacsbrdata.h index 44d578f7fc..02491c3356 100644 --- a/libavcodec/aacsbrdata.h +++ b/libavcodec/aacsbrdata.h @@ -352,7 +352,7 @@ static DECLARE_ALIGNED(16, float, sbr_qmf_window_us)[640] = { 0.8537385600, }; -static const float sbr_noise_table[512][2] = { +const float ff_sbr_noise_table[512][2] = { {-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647}, { 0.14130051758487, -0.95090983575689}, {-0.47005496701697, -0.37340549728647}, { 0.80705063769351, 0.29653668284408}, {-0.38981478896926, 0.89572605717087}, diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h index 5b0f334219..58f4b61341 100644 --- a/libavcodec/sbr.h +++ b/libavcodec/sbr.h @@ -32,6 +32,7 @@ #include #include "fft.h" #include "aacps.h" +#include "sbrdsp.h" /** * Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header. @@ -180,6 +181,7 @@ typedef struct { DECLARE_ALIGNED(16, float, qmf_filter_scratch)[5][64]; FFTContext mdct_ana; FFTContext mdct; + SBRDSPContext dsp; } SpectralBandReplication; #endif /* AVCODEC_SBR_H */ diff --git a/libavcodec/sbrdsp.c b/libavcodec/sbrdsp.c new file mode 100644 index 0000000000..7be962ed77 --- /dev/null +++ b/libavcodec/sbrdsp.c @@ -0,0 +1,237 @@ +/* + * AAC Spectral Band Replication decoding functions + * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl ) + * Copyright (c) 2009-2010 Alex Converse + * + * 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 "libavutil/attributes.h" +#include "sbrdsp.h" + +static void sbr_sum64x5_c(float *z) +{ + int k; + for (k = 0; k < 64; k++) { + float f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256]; + z[k] = f; + } +} + +static float sbr_sum_square_c(float (*x)[2], int n) +{ + float sum = 0.0f; + int i; + + for (i = 0; i < n; i++) + sum += x[i][0] * x[i][0] + x[i][1] * x[i][1]; + + return sum; +} + +static void sbr_neg_odd_64_c(float *x) +{ + int i; + for (i = 1; i < 64; i += 2) + x[i] = -x[i]; +} + +static void sbr_qmf_pre_shuffle_c(float *z) +{ + int k; + z[64] = z[0]; + z[65] = z[1]; + for (k = 1; k < 32; k++) { + z[64+2*k ] = -z[64 - k]; + z[64+2*k+1] = z[ k + 1]; + } +} + +static void sbr_qmf_post_shuffle_c(float W[32][2], const float *z) +{ + int k; + for (k = 0; k < 32; k++) { + W[k][0] = -z[63-k]; + W[k][1] = z[k]; + } +} + +static void sbr_qmf_deint_neg_c(float *v, const float *src) +{ + int i; + for (i = 0; i < 32; i++) { + v[ i] = src[63 - 2*i ]; + v[63 - i] = -src[63 - 2*i - 1]; + } +} + +static void sbr_qmf_deint_bfly_c(float *v, const float *src0, const float *src1) +{ + int i; + for (i = 0; i < 64; i++) { + v[ i] = src0[i] - src1[63 - i]; + v[127 - i] = src0[i] + src1[63 - i]; + } +} + +static av_always_inline void autocorrelate(const float x[40][2], + float phi[3][2][2], int lag) +{ + int i; + float real_sum = 0.0f; + float imag_sum = 0.0f; + if (lag) { + for (i = 1; i < 38; i++) { + real_sum += x[i][0] * x[i+lag][0] + x[i][1] * x[i+lag][1]; + imag_sum += x[i][0] * x[i+lag][1] - x[i][1] * x[i+lag][0]; + } + phi[2-lag][1][0] = real_sum + x[ 0][0] * x[lag][0] + x[ 0][1] * x[lag][1]; + phi[2-lag][1][1] = imag_sum + x[ 0][0] * x[lag][1] - x[ 0][1] * x[lag][0]; + if (lag == 1) { + phi[0][0][0] = real_sum + x[38][0] * x[39][0] + x[38][1] * x[39][1]; + phi[0][0][1] = imag_sum + x[38][0] * x[39][1] - x[38][1] * x[39][0]; + } + } else { + for (i = 1; i < 38; i++) { + real_sum += x[i][0] * x[i][0] + x[i][1] * x[i][1]; + } + phi[2][1][0] = real_sum + x[ 0][0] * x[ 0][0] + x[ 0][1] * x[ 0][1]; + phi[1][0][0] = real_sum + x[38][0] * x[38][0] + x[38][1] * x[38][1]; + } +} + +static void sbr_autocorrelate_c(const float x[40][2], float phi[3][2][2]) +{ + autocorrelate(x, phi, 0); + autocorrelate(x, phi, 1); + autocorrelate(x, phi, 2); +} + +static void sbr_hf_gen_c(float (*X_high)[2], const float (*X_low)[2], + const float alpha0[2], const float alpha1[2], + float bw, int start, int end) +{ + float alpha[4]; + int i; + + alpha[0] = alpha1[0] * bw * bw; + alpha[1] = alpha1[1] * bw * bw; + alpha[2] = alpha0[0] * bw; + alpha[3] = alpha0[1] * bw; + + for (i = start; i < end; i++) { + X_high[i][0] = + X_low[i - 2][0] * alpha[0] - + X_low[i - 2][1] * alpha[1] + + X_low[i - 1][0] * alpha[2] - + X_low[i - 1][1] * alpha[3] + + X_low[i][0]; + X_high[i][1] = + X_low[i - 2][1] * alpha[0] + + X_low[i - 2][0] * alpha[1] + + X_low[i - 1][1] * alpha[2] + + X_low[i - 1][0] * alpha[3] + + X_low[i][1]; + } +} + +static void sbr_hf_g_filt_c(float (*Y)[2], const float (*X_high)[40][2], + const float *g_filt, int m_max, int ixh) +{ + int m; + + for (m = 0; m < m_max; m++) { + Y[m][0] = X_high[m][ixh][0] * g_filt[m]; + Y[m][1] = X_high[m][ixh][1] * g_filt[m]; + } +} + +static av_always_inline void sbr_hf_apply_noise(float (*Y)[2], + const float *s_m, + const float *q_filt, + int noise, + float phi_sign0, + float phi_sign1, + int m_max) +{ + int m; + + for (m = 0; m < m_max; m++) { + float y0 = Y[m][0]; + float y1 = Y[m][1]; + noise = (noise + 1) & 0x1ff; + if (s_m[m]) { + y0 += s_m[m] * phi_sign0; + y1 += s_m[m] * phi_sign1; + } else { + y0 += q_filt[m] * ff_sbr_noise_table[noise][0]; + y1 += q_filt[m] * ff_sbr_noise_table[noise][1]; + } + Y[m][0] = y0; + Y[m][1] = y1; + phi_sign1 = -phi_sign1; + } +} + +static void sbr_hf_apply_noise_0(float (*Y)[2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max) +{ + sbr_hf_apply_noise(Y, s_m, q_filt, noise, 1.0, 0.0, m_max); +} + +static void sbr_hf_apply_noise_1(float (*Y)[2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max) +{ + float phi_sign = 1 - 2 * (kx & 1); + sbr_hf_apply_noise(Y, s_m, q_filt, noise, 0.0, phi_sign, m_max); +} + +static void sbr_hf_apply_noise_2(float (*Y)[2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max) +{ + sbr_hf_apply_noise(Y, s_m, q_filt, noise, -1.0, 0.0, m_max); +} + +static void sbr_hf_apply_noise_3(float (*Y)[2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max) +{ + float phi_sign = 1 - 2 * (kx & 1); + sbr_hf_apply_noise(Y, s_m, q_filt, noise, 0.0, -phi_sign, m_max); +} + +av_cold void ff_sbrdsp_init(SBRDSPContext *s) +{ + s->sum64x5 = sbr_sum64x5_c; + s->sum_square = sbr_sum_square_c; + s->neg_odd_64 = sbr_neg_odd_64_c; + s->qmf_pre_shuffle = sbr_qmf_pre_shuffle_c; + s->qmf_post_shuffle = sbr_qmf_post_shuffle_c; + s->qmf_deint_neg = sbr_qmf_deint_neg_c; + s->qmf_deint_bfly = sbr_qmf_deint_bfly_c; + s->autocorrelate = sbr_autocorrelate_c; + s->hf_gen = sbr_hf_gen_c; + s->hf_g_filt = sbr_hf_g_filt_c; + + s->hf_apply_noise[0] = sbr_hf_apply_noise_0; + s->hf_apply_noise[1] = sbr_hf_apply_noise_1; + s->hf_apply_noise[2] = sbr_hf_apply_noise_2; + s->hf_apply_noise[3] = sbr_hf_apply_noise_3; +} diff --git a/libavcodec/sbrdsp.h b/libavcodec/sbrdsp.h new file mode 100644 index 0000000000..2f6cf1e4c5 --- /dev/null +++ b/libavcodec/sbrdsp.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2012 Mans Rullgard + * + * 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 + */ + +#ifndef LIBAVCODEC_SBRDSP_H +#define LIBAVCODEC_SBRDSP_H + +typedef struct SBRDSPContext { + void (*sum64x5)(float *z); + float (*sum_square)(float (*x)[2], int n); + void (*neg_odd_64)(float *x); + void (*qmf_pre_shuffle)(float *z); + void (*qmf_post_shuffle)(float W[32][2], const float *z); + void (*qmf_deint_neg)(float *v, const float *src); + void (*qmf_deint_bfly)(float *v, const float *src0, const float *src1); + void (*autocorrelate)(const float x[40][2], float phi[3][2][2]); + void (*hf_gen)(float (*X_high)[2], const float (*X_low)[2], + const float alpha0[2], const float alpha1[2], + float bw, int start, int end); + void (*hf_g_filt)(float (*Y)[2], const float (*X_high)[40][2], + const float *g_filt, int m_max, int ixh); + void (*hf_apply_noise[4])(float (*Y)[2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +} SBRDSPContext; + +extern const float ff_sbr_noise_table[][2]; + +void ff_sbrdsp_init(SBRDSPContext *s); + +#endif From 8996ed2b7324f35798c4198b495f8a6955d2047d Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 13 Jan 2012 14:31:18 +0000 Subject: [PATCH 03/10] aacsbr: align some arrays Signed-off-by: Mans Rullgard --- libavcodec/aacsbr.c | 8 +++++--- libavcodec/aacsbrdata.h | 4 +++- libavcodec/sbr.h | 12 ++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 01601b035c..3a30fcad7f 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -1220,7 +1220,8 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp, { int k; for (k = 0; k < k0; k++) { - float phi[3][2][2], dk; + LOCAL_ALIGNED_16(float, phi, [3], [2][2]); + float dk; dsp->autocorrelate(X_low[k], phi); @@ -1580,8 +1581,9 @@ static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2] for (e = 0; e < ch_data->bs_num_env; e++) { for (i = 2 * ch_data->t_env[e]; i < 2 * ch_data->t_env[e + 1]; i++) { int phi_sign = (1 - 2*(kx & 1)); - float g_filt_tab[48], *g_filt; - float q_filt_tab[48], *q_filt; + LOCAL_ALIGNED_16(float, g_filt_tab, [48]); + LOCAL_ALIGNED_16(float, q_filt_tab, [48]); + float *g_filt, *q_filt; if (h_SL && e != e_a[0] && e != e_a[1]) { g_filt = g_filt_tab; diff --git a/libavcodec/aacsbrdata.h b/libavcodec/aacsbrdata.h index 02491c3356..fb02a77f7d 100644 --- a/libavcodec/aacsbrdata.h +++ b/libavcodec/aacsbrdata.h @@ -352,7 +352,8 @@ static DECLARE_ALIGNED(16, float, sbr_qmf_window_us)[640] = { 0.8537385600, }; -const float ff_sbr_noise_table[512][2] = { +/* First two entries repeated at end to simplify SIMD implementations. */ +const DECLARE_ALIGNED(16, float, ff_sbr_noise_table)[][2] = { {-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647}, { 0.14130051758487, -0.95090983575689}, {-0.47005496701697, -0.37340549728647}, { 0.80705063769351, 0.29653668284408}, {-0.38981478896926, 0.89572605717087}, @@ -609,6 +610,7 @@ const float ff_sbr_noise_table[512][2] = { {-0.93412041758744, 0.41374052024363}, { 0.96063943315511, 0.93116709541280}, { 0.97534253457837, 0.86150930812689}, { 0.99642466504163, 0.70190043427512}, {-0.94705089665984, -0.29580042814306}, { 0.91599807087376, -0.98147830385781}, +{-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647}, }; #endif /* AVCODEC_AACSBRDATA_H */ diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h index 58f4b61341..7d06faddde 100644 --- a/libavcodec/sbr.h +++ b/libavcodec/sbr.h @@ -88,8 +88,8 @@ typedef struct { ///QMF values of the original signal float W[2][32][32][2]; ///QMF output of the HF adjustor - float Y[2][38][64][2]; - float g_temp[42][48]; + DECLARE_ALIGNED(16, float, Y)[2][38][64][2]; + DECLARE_ALIGNED(16, float, g_temp)[42][48]; float q_temp[42][48]; uint8_t s_indexmapped[8][48]; ///Envelope scalefactors @@ -156,15 +156,15 @@ typedef struct { uint8_t patch_num_subbands[6]; uint8_t patch_start_subband[6]; ///QMF low frequency input to the HF generator - float X_low[32][40][2]; + DECLARE_ALIGNED(16, float, X_low)[32][40][2]; ///QMF output of the HF generator - float X_high[64][40][2]; + DECLARE_ALIGNED(16, float, X_high)[64][40][2]; ///QMF values of the reconstructed signal DECLARE_ALIGNED(16, float, X)[2][2][38][64]; ///Zeroth coefficient used to filter the subband signals - float alpha0[64][2]; + DECLARE_ALIGNED(16, float, alpha0)[64][2]; ///First coefficient used to filter the subband signals - float alpha1[64][2]; + DECLARE_ALIGNED(16, float, alpha1)[64][2]; ///Dequantized envelope scalefactors, remapped float e_origmapped[7][48]; ///Dequantized noise scalefactors, remapped From be822d77b6f8363df0a49c568662187d655711e2 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 12 Jan 2012 23:44:20 +0000 Subject: [PATCH 04/10] aacsbr: ARM NEON optimised sbrdsp functions Overall speedup of HE-AAC decoding 2.3x on Cortex-A8, 1.2x on A9. Signed-off-by: Mans Rullgard --- libavcodec/arm/Makefile | 4 + libavcodec/arm/sbrdsp_init_arm.c | 70 ++++++ libavcodec/arm/sbrdsp_neon.S | 411 +++++++++++++++++++++++++++++++ libavcodec/sbrdsp.c | 4 + libavcodec/sbrdsp.h | 1 + 5 files changed, 490 insertions(+) create mode 100644 libavcodec/arm/sbrdsp_init_arm.c create mode 100644 libavcodec/arm/sbrdsp_neon.S diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile index fc1711395b..e7fa7e511a 100644 --- a/libavcodec/arm/Makefile +++ b/libavcodec/arm/Makefile @@ -1,6 +1,8 @@ OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \ arm/ac3dsp_arm.o +OBJS-$(CONFIG_AAC_DECODER) += arm/sbrdsp_init_arm.o + OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \ ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o @@ -60,6 +62,8 @@ NEON-OBJS-$(CONFIG_H264PRED) += arm/h264pred_neon.o \ NEON-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_neon.o +NEON-OBJS-$(CONFIG_AAC_DECODER) += arm/sbrdsp_neon.o + NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ arm/synth_filter_neon.o \ diff --git a/libavcodec/arm/sbrdsp_init_arm.c b/libavcodec/arm/sbrdsp_init_arm.c new file mode 100644 index 0000000000..2ab0df829d --- /dev/null +++ b/libavcodec/arm/sbrdsp_init_arm.c @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2012 Mans Rullgard + * + * 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 "config.h" +#include "libavutil/attributes.h" +#include "libavcodec/sbrdsp.h" + +void ff_sbr_sum64x5_neon(float *z); +float ff_sbr_sum_square_neon(float (*x)[2], int n); +void ff_sbr_neg_odd_64_neon(float *x); +void ff_sbr_qmf_pre_shuffle_neon(float *z); +void ff_sbr_qmf_post_shuffle_neon(float W[32][2], const float *z); +void ff_sbr_qmf_deint_neg_neon(float *v, const float *src); +void ff_sbr_qmf_deint_bfly_neon(float *v, const float *src0, const float *src1); +void ff_sbr_hf_g_filt_neon(float (*Y)[2], const float (*X_high)[40][2], + const float *g_filt, int m_max, int ixh); +void ff_sbr_hf_gen_neon(float (*X_high)[2], const float (*X_low)[2], + const float alpha0[2], const float alpha1[2], + float bw, int start, int end); +void ff_sbr_autocorrelate_neon(const float x[40][2], float phi[3][2][2]); + +void ff_sbr_hf_apply_noise_0_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_1_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_2_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_3_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); + +av_cold void ff_sbrdsp_init_arm(SBRDSPContext *s) +{ + if (HAVE_NEON) { + s->sum64x5 = ff_sbr_sum64x5_neon; + s->sum_square = ff_sbr_sum_square_neon; + s->neg_odd_64 = ff_sbr_neg_odd_64_neon; + s->qmf_pre_shuffle = ff_sbr_qmf_pre_shuffle_neon; + s->qmf_post_shuffle = ff_sbr_qmf_post_shuffle_neon; + s->qmf_deint_neg = ff_sbr_qmf_deint_neg_neon; + s->qmf_deint_bfly = ff_sbr_qmf_deint_bfly_neon; + s->hf_g_filt = ff_sbr_hf_g_filt_neon; + s->hf_gen = ff_sbr_hf_gen_neon; + s->autocorrelate = ff_sbr_autocorrelate_neon; + s->hf_apply_noise[0] = ff_sbr_hf_apply_noise_0_neon; + s->hf_apply_noise[1] = ff_sbr_hf_apply_noise_1_neon; + s->hf_apply_noise[2] = ff_sbr_hf_apply_noise_2_neon; + s->hf_apply_noise[3] = ff_sbr_hf_apply_noise_3_neon; + } +} diff --git a/libavcodec/arm/sbrdsp_neon.S b/libavcodec/arm/sbrdsp_neon.S new file mode 100644 index 0000000000..835c32caee --- /dev/null +++ b/libavcodec/arm/sbrdsp_neon.S @@ -0,0 +1,411 @@ +/* + * Copyright (c) 2012 Mans Rullgard + * + * 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 "asm.S" + +function ff_sbr_sum64x5_neon, export=1 + push {lr} + add r1, r0, # 64*4 + add r2, r0, #128*4 + add r3, r0, #192*4 + add lr, r0, #256*4 + mov r12, #64 +1: + vld1.32 {q0}, [r0,:128] + vld1.32 {q1}, [r1,:128]! + vadd.f32 q0, q0, q1 + vld1.32 {q2}, [r2,:128]! + vadd.f32 q0, q0, q2 + vld1.32 {q3}, [r3,:128]! + vadd.f32 q0, q0, q3 + vld1.32 {q8}, [lr,:128]! + vadd.f32 q0, q0, q8 + vst1.32 {q0}, [r0,:128]! + subs r12, #4 + bgt 1b + pop {pc} +endfunc + +function ff_sbr_sum_square_neon, export=1 + vmov.f32 q0, #0.0 +1: + vld1.32 {q1}, [r0,:128]! + vmla.f32 q0, q1, q1 + subs r1, r1, #2 + bgt 1b + vadd.f32 d0, d0, d1 + vpadd.f32 d0, d0, d0 +NOVFP vmov.32 r0, d0[0] + bx lr +endfunc + +function ff_sbr_neg_odd_64_neon, export=1 + mov r1, r0 + vmov.i32 q8, #1<<31 + vld2.32 {q0,q1}, [r0,:128]! + veor q1, q1, q8 + vld2.32 {q2,q3}, [r0,:128]! + .rept 3 + vst2.32 {q0,q1}, [r1,:128]! + veor q3, q3, q8 + vld2.32 {q0,q1}, [r0,:128]! + vst2.32 {q2,q3}, [r1,:128]! + veor q1, q1, q8 + vld2.32 {q2,q3}, [r0,:128]! + .endr + veor q3, q3, q8 + vst2.32 {q0,q1}, [r1,:128]! + vst2.32 {q2,q3}, [r1,:128]! + bx lr +endfunc + +function ff_sbr_qmf_pre_shuffle_neon, export=1 + add r1, r0, #60*4 + add r2, r0, #64*4 + vld1.32 {d0}, [r0,:64]! + vst1.32 {d0}, [r2,:64]! + mov r3, #-16 + mov r12, #24 + vmov.i32 q8, #1<<31 + vld1.32 {q0}, [r1,:128], r3 + vld1.32 {d2}, [r0,:64]! +1: + vld1.32 {d3,d4}, [r0,:128]! + vrev64.32 q0, q0 + vld1.32 {q9}, [r1,:128], r3 + veor q0, q0, q8 + vld1.32 {d5,d6}, [r0,:128]! + vswp d0, d1 + vrev64.32 q9, q9 + vst2.32 {q0,q1}, [r2,:64]! + vmov q10, q2 + veor q9, q9, q8 + vmov d2, d6 + vswp d18, d19 + vld1.32 {q0}, [r1,:128], r3 + vst2.32 {q9,q10}, [r2,:64]! + subs r12, r12, #8 + bgt 1b + vld1.32 {d3,d4}, [r0,:128]! + vrev64.32 q0, q0 + vld1.32 {q9}, [r1,:128], r3 + veor q0, q0, q8 + vld1.32 {d5}, [r0,:64]! + vswp d0, d1 + vrev64.32 q9, q9 + vst2.32 {q0,q1}, [r2,:64]! + vswp d4, d5 + veor q1, q9, q8 + vst2.32 {d3,d5}, [r2,:64]! + vst2.32 {d2[0],d4[0]}, [r2,:64]! + bx lr +endfunc + +function ff_sbr_qmf_post_shuffle_neon, export=1 + add r2, r1, #60*4 + mov r3, #-16 + mov r12, #32 + vmov.i32 q8, #1<<31 + vld1.32 {q0}, [r2,:128], r3 + vld1.32 {q1}, [r1,:128]! +1: + pld [r2, #-32] + vrev64.32 q0, q0 + vswp d2, d3 + veor q0, q0, q8 + vld1.32 {q2}, [r2,:128], r3 + vld1.32 {q3}, [r1,:128]! + vst2.32 {d1,d3}, [r0,:128]! + vst2.32 {d0,d2}, [r0,:128]! + pld [r2, #-32] + vrev64.32 q2, q2 + vswp d6, d7 + veor q2, q2, q8 + vld1.32 {q0}, [r2,:128], r3 + vld1.32 {q1}, [r1,:128]! + vst2.32 {d5,d7}, [r0,:128]! + vst2.32 {d4,d6}, [r0,:128]! + subs r12, r12, #8 + bgt 1b + bx lr +endfunc + +function ff_sbr_qmf_deint_neg_neon, export=1 + add r1, r1, #60*4 + add r2, r0, #62*4 + mov r3, #-16 + mov r12, #32 + vmov.i32 d2, #1<<31 +1: + vld2.32 {d0,d1}, [r1,:128], r3 + veor d0, d0, d2 + vrev64.32 d1, d1 + vst1.32 {d0}, [r2,:64] + vst1.32 {d1}, [r0,:64]! + sub r2, r2, #8 + subs r12, r12, #2 + bgt 1b + bx lr +endfunc + +function ff_sbr_qmf_deint_bfly_neon, export=1 + push {lr} + add r2, r2, #60*4 + add r3, r0, #124*4 + mov r12, #64 + mov lr, #-16 +1: + vld1.32 {q0}, [r1,:128]! + vld1.32 {q1}, [r2,:128], lr + vrev64.32 q2, q0 + vrev64.32 q3, q1 + vadd.f32 d3, d4, d3 + vadd.f32 d2, d5, d2 + vsub.f32 d0, d0, d7 + vsub.f32 d1, d1, d6 + vst1.32 {q1}, [r3,:128], lr + vst1.32 {q0}, [r0,:128]! + subs r12, r12, #4 + bgt 1b + pop {pc} +endfunc + +function ff_sbr_hf_g_filt_neon, export=1 + ldr r12, [sp] + add r1, r1, r12, lsl #3 + mov r12, #40*2*4 + sub r3, r3, #1 + vld2.32 {d2[],d3[]},[r2,:64]! + vld1.32 {d0}, [r1,:64], r12 +1: + vld1.32 {d1}, [r1,:64], r12 + vmul.f32 q3, q0, q1 + vld2.32 {d2[],d3[]},[r2,:64]! + vld1.32 {d0}, [r1,:64], r12 + vst1.32 {q3}, [r0,:64]! + subs r3, r3, #2 + bgt 1b + it lt + bxlt lr + vmul.f32 d0, d0, d2 + vst1.32 {d0}, [r0,:64]! + bx lr +endfunc + +function ff_sbr_hf_gen_neon, export=1 +NOVFP vld1.32 {d1[]}, [sp,:32] +VFP vdup.32 d1, d0[0] + vmul.f32 d0, d1, d1 + vld1.32 {d3}, [r2,:64] + vld1.32 {d2}, [r3,:64] + vmul.f32 q0, q0, q1 + ldrd r2, r3, [sp, #4*!HAVE_VFP_ARGS] + vtrn.32 d0, d1 + vneg.f32 d18, d1 + vtrn.32 d18, d1 + add r0, r0, r2, lsl #3 + add r1, r1, r2, lsl #3 + sub r1, r1, #2*8 + sub r3, r3, r2 + vld1.32 {q1}, [r1,:128]! +1: + vld1.32 {q3}, [r1,:128]! + vrev64.32 q2, q1 + vmov q8, q3 + vrev64.32 d20, d3 + vrev64.32 d21, d6 + vmla.f32 q3, q1, d0[0] + vmla.f32 d6, d4, d18 + vmla.f32 d7, d20, d18 + vmla.f32 d6, d3, d0[1] + vmla.f32 d7, d16, d0[1] + vmla.f32 d6, d5, d1 + vmla.f32 d7, d21, d1 + vmov q1, q8 + vst1.32 {q3}, [r0,:128]! + subs r3, r3, #2 + bgt 1b + bx lr +endfunc + +function ff_sbr_autocorrelate_neon, export=1 + vld1.32 {q0}, [r0,:128]! + vmov.f32 q1, #0.0 + vmov.f32 q3, #0.0 + vmov.f32 d20, #0.0 + vmul.f32 d21, d1, d1 + vmov q8, q0 + vmov q11, q0 + mov r12, #36 +1: + vld1.32 {q2}, [r0,:128]! + vrev64.32 q12, q2 + vmla.f32 q10, q2, q2 + vmla.f32 d2, d1, d4 + vmla.f32 d3, d1, d24 + vmla.f32 d6, d0, d4 + vmla.f32 d7, d0, d24 + vmla.f32 d2, d4, d5 + vmla.f32 d3, d4, d25 + vmla.f32 d6, d1, d5 + vmla.f32 d7, d1, d25 + vmov q0, q2 + subs r12, r12, #2 + bgt 1b + vld1.32 {q2}, [r0,:128]! + vrev64.32 q12, q2 + vmla.f32 d2, d1, d4 + vmla.f32 d3, d1, d24 + vmla.f32 d6, d0, d4 + vmla.f32 d7, d0, d24 + vadd.f32 d20, d20, d21 + vrev64.32 d18, d17 + vmla.f32 d6, d1, d5 + vmla.f32 d7, d1, d25 + vmov q0, q1 + vmla.f32 d0, d16, d17 + vmla.f32 d1, d16, d18 + vmla.f32 d2, d4, d5 + vmla.f32 d3, d4, d25 + vneg.f32 s15, s15 + vmov d21, d20 + vpadd.f32 d0, d0, d2 + vpadd.f32 d7, d6, d7 + vtrn.32 d1, d3 + vsub.f32 d6, d1, d3 + vmla.f32 d20, d22, d22 + vmla.f32 d21, d4, d4 + vtrn.32 d0, d6 + vpadd.f32 d20, d20, d21 + vst1.32 {q3}, [r1,:128]! + vst1.32 {d20[1]}, [r1,:32] + add r1, r1, #2*4 + vst1.32 {d0}, [r1,:64] + add r1, r1, #4*4 + vst1.32 {d20[0]}, [r1,:32] + bx lr +endfunc + +function ff_sbr_hf_apply_noise_0_neon, export=1 + vmov.i32 d3, #0 +.Lhf_apply_noise_0: + push {r4,lr} + ldr r12, [sp, #12] + movrel r4, X(ff_sbr_noise_table) + add r3, r3, #1 + bfc r3, #9, #23 + sub r12, r12, #1 +1: + add lr, r4, r3, lsl #3 + vld2.32 {q0}, [r0,:64] + vld2.32 {q3}, [lr,:64] + vld1.32 {d2}, [r1,:64]! + vld1.32 {d18}, [r2,:64]! + vceq.f32 d16, d2, #0 + veor d2, d2, d3 + vmov q2, q0 + vmla.f32 d0, d6, d18 + vmla.f32 d1, d7, d18 + vadd.f32 d4, d4, d2 + add r3, r3, #2 + bfc r3, #9, #23 + vbif d0, d4, d16 + vbif d1, d5, d16 + vst2.32 {q0}, [r0,:64]! + subs r12, r12, #2 + bgt 1b + blt 2f + add lr, r4, r3, lsl #3 + vld1.32 {d0}, [r0,:64] + vld1.32 {d6}, [lr,:64] + vld1.32 {d2[]}, [r1,:32]! + vld1.32 {d3[]}, [r2,:32]! + vceq.f32 d4, d2, #0 + veor d2, d2, d3 + vmov d1, d0 + vmla.f32 d0, d6, d3 + vadd.f32 s2, s2, s4 + vbif d0, d1, d4 + vst1.32 {d0}, [r0,:64]! +2: + pop {r4,pc} +endfunc + +function ff_sbr_hf_apply_noise_1_neon, export=1 + ldr r12, [sp] + push {r4,lr} + lsl r12, r12, #31 + eor lr, r12, #1<<31 + vmov d3, r12, lr +.Lhf_apply_noise_1: + ldr r12, [sp, #12] + movrel r4, X(ff_sbr_noise_table) + add r3, r3, #1 + bfc r3, #9, #23 + sub r12, r12, #1 +1: + add lr, r4, r3, lsl #3 + vld2.32 {q0}, [r0,:64] + vld2.32 {q3}, [lr,:64] + vld1.32 {d2}, [r1,:64]! + vld1.32 {d18}, [r2,:64]! + vceq.f32 d16, d2, #0 + veor d2, d2, d3 + vmov q2, q0 + vmla.f32 d0, d6, d18 + vmla.f32 d1, d7, d18 + vadd.f32 d5, d5, d2 + add r3, r3, #2 + bfc r3, #9, #23 + vbif d0, d4, d16 + vbif d1, d5, d16 + vst2.32 {q0}, [r0,:64]! + subs r12, r12, #2 + bgt 1b + blt 2f + add lr, r4, r3, lsl #3 + vld1.32 {d0}, [r0,:64] + vld1.32 {d6}, [lr,:64] + vld1.32 {d2[]}, [r1,:32]! + vld1.32 {d18[]}, [r2,:32]! + vceq.f32 d4, d2, #0 + veor d2, d2, d3 + vmov d1, d0 + vmla.f32 d0, d6, d18 + vadd.f32 s3, s3, s5 + vbif d0, d1, d4 + vst1.32 {d0}, [r0,:64]! +2: + pop {r4,pc} +endfunc + +function ff_sbr_hf_apply_noise_2_neon, export=1 + vmov.i32 d3, #1<<31 + b .Lhf_apply_noise_0 +endfunc + +function ff_sbr_hf_apply_noise_3_neon, export=1 + ldr r12, [sp] + push {r4,lr} + lsl r12, r12, #31 + eor lr, r12, #1<<31 + vmov d3, lr, r12 + b .Lhf_apply_noise_1 +endfunc diff --git a/libavcodec/sbrdsp.c b/libavcodec/sbrdsp.c index 7be962ed77..2711e71338 100644 --- a/libavcodec/sbrdsp.c +++ b/libavcodec/sbrdsp.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" #include "libavutil/attributes.h" #include "sbrdsp.h" @@ -234,4 +235,7 @@ av_cold void ff_sbrdsp_init(SBRDSPContext *s) s->hf_apply_noise[1] = sbr_hf_apply_noise_1; s->hf_apply_noise[2] = sbr_hf_apply_noise_2; s->hf_apply_noise[3] = sbr_hf_apply_noise_3; + + if (ARCH_ARM) + ff_sbrdsp_init_arm(s); } diff --git a/libavcodec/sbrdsp.h b/libavcodec/sbrdsp.h index 2f6cf1e4c5..88285b07ec 100644 --- a/libavcodec/sbrdsp.h +++ b/libavcodec/sbrdsp.h @@ -43,5 +43,6 @@ typedef struct SBRDSPContext { extern const float ff_sbr_noise_table[][2]; void ff_sbrdsp_init(SBRDSPContext *s); +void ff_sbrdsp_init_arm(SBRDSPContext *s); #endif From 2d9535ad317733c977a89194975f14e0cc04fb7f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 28 Jan 2012 08:46:22 +0100 Subject: [PATCH 05/10] avcodec_align_dimensions2: set only 4 linesizes, not AV_NUM_DATA_POINTERS. This function is video-only, so there's no point in setting more linesizes. Fixes stack corruption in avplay. --- libavcodec/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 707ecb5fef..34a4122d5d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -219,7 +219,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, *height+=2; // some of the optimized chroma MC reads one line too much // which is also done in mpeg decoders with lowres > 0 - for (i = 0; i < AV_NUM_DATA_POINTERS; i++) + for (i = 0; i < 4; i++) linesize_align[i] = STRIDE_ALIGN; //STRIDE_ALIGN is 8 for SSE* but this does not work for SVQ1 chroma planes //we could change STRIDE_ALIGN to 16 for x86/sse but it would increase the @@ -229,7 +229,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, if(s->codec_id == CODEC_ID_SVQ1 || s->codec_id == CODEC_ID_VP5 || s->codec_id == CODEC_ID_VP6 || s->codec_id == CODEC_ID_VP6F || s->codec_id == CODEC_ID_VP6A) { - for (i = 0; i < AV_NUM_DATA_POINTERS; i++) + for (i = 0; i < 4; i++) linesize_align[i] = 16; } #endif From 44911f2985b9bf823e0605f177e3dbb1f66d3e16 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 28 Jan 2012 09:05:55 +0100 Subject: [PATCH 06/10] APIchanges: mention avcodec_alloc_context()/2/3 There was no minor bump for making avcodec_alloc_context3() public and deprecating the other two, so I'm using the first next lavc bump. --- doc/APIchanges | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 7e5efe8846..7cac096a3c 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -163,6 +163,8 @@ API changes, most recent first: 2011-07-10 - 0b950fe - lavc 53.6.0 Add avcodec_open2(), deprecate avcodec_open(). + Add avcodec_alloc_context3. Deprecate avcodec_alloc_context() and + avcodec_alloc_context2(). 2011-06-23 - 67e9ae1 - lavu 51.8.0 - attributes.h Add av_printf_format(). From 9bfe218299a1a206356c702c8651e5c6bdb0c009 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 28 Jan 2012 09:08:42 +0100 Subject: [PATCH 07/10] lavc: extend doxy for avcodec_alloc_context3(). --- libavcodec/avcodec.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 18db7c55d9..d8e56caeac 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3415,6 +3415,9 @@ int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec); * @param codec if non-NULL, allocate private data and initialize defaults * for the given codec. It is illegal to then call avcodec_open2() * with a different codec. + * If NULL, then the codec-specific defaults won't be initialized, + * which may result in suboptimal default settings (this is + * important mainly for encoders, e.g. libx264). * * @return An AVCodecContext filled with default values or NULL on failure. * @see avcodec_get_context_defaults From 91b3bfba88fc820623b75dea9caa9c11b68e2d09 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 28 Jan 2012 19:30:30 +0100 Subject: [PATCH 08/10] avplay: use the correct array size for stride. AV_NUM_DATA_POINTERS instead of 4. --- avplay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avplay.c b/avplay.c index 19e2bdcc18..f20b6315fb 100644 --- a/avplay.c +++ b/avplay.c @@ -1527,7 +1527,7 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic) AVFilterContext *ctx = codec->opaque; AVFilterBufferRef *ref; int perms = AV_PERM_WRITE; - int i, w, h, stride[4]; + int i, w, h, stride[AV_NUM_DATA_POINTERS]; unsigned edge; int pixel_size; From dc7e7d4dd96eebd430e7bfa847b751add0e126ab Mon Sep 17 00:00:00 2001 From: Nathan Caldwell Date: Fri, 27 Jan 2012 22:23:40 -0700 Subject: [PATCH 09/10] aacenc: Fix a bug where deinterleaved samples were stored in the wrong place. 10l: Forgot to adjust deinterleave for new location of incoming samples in 7946a5a. This produced incorrect, but surprisingly listenable results. Thanks to Justin Ruggles for the report. Signed-off-by: Anton Khirnov --- libavcodec/aacenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index d7a6d5a63c..765f9a7e3e 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -487,10 +487,10 @@ static void deinterleave_input_samples(AACEncContext *s, const float *sptr = samples + channel_map[ch]; /* copy last 1024 samples of previous frame to the start of the current frame */ - memcpy(&s->planar_samples[ch][0], &s->planar_samples[ch][1024], 1024 * sizeof(s->planar_samples[0][0])); + memcpy(&s->planar_samples[ch][1024], &s->planar_samples[ch][2048], 1024 * sizeof(s->planar_samples[0][0])); /* deinterleave */ - for (i = 1024; i < 1024 * 2; i++) { + for (i = 2048; i < 3072; i++) { s->planar_samples[ch][i] = *sptr; sptr += sinc; } From 2e626dd5136f4daa244b37284e22483cdc7df1ac Mon Sep 17 00:00:00 2001 From: Nathan Caldwell Date: Fri, 27 Jan 2012 22:23:41 -0700 Subject: [PATCH 10/10] aacenc: Fix LONG_START windowing. Forgot to add the equivalent amount to the incoming sample pointer as the output pointer. Signed-off-by: Anton Khirnov --- libavcodec/aacenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 765f9a7e3e..e610a8006f 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -200,8 +200,8 @@ WINDOW_FUNC(long_start) float *out = sce->ret; dsp->vector_fmul(out, audio, lwindow, 1024); - memcpy(out + 1024, audio, sizeof(out[0]) * 448); - dsp->vector_fmul_reverse(out + 1024 + 448, audio, swindow, 128); + memcpy(out + 1024, audio + 1024, sizeof(out[0]) * 448); + dsp->vector_fmul_reverse(out + 1024 + 448, audio + 1024 + 448, swindow, 128); memset(out + 1024 + 576, 0, sizeof(out[0]) * 448); }