From 8dbaa5bd695e9f0fc3f7bbf52a76fd0d7caa2b80 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Tue, 21 Jun 2011 23:12:42 -0700 Subject: aacenc: Fix codebook trellising for zeroed bands. Choose band type (codebook) zero, count its bits, and mark the other states as unnavigable. --- libavcodec/aaccoder.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 4d5b98f..e752b63 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -432,10 +432,26 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, for (swb = 0; swb < max_sfb; swb++) { size = sce->ics.swb_sizes[swb]; if (sce->zeroes[win*16 + swb]) { - for (cb = 0; cb < 12; cb++) { - path[swb+1][cb].prev_idx = cb; - path[swb+1][cb].cost = path[swb][cb].cost; - path[swb+1][cb].run = path[swb][cb].run + 1; + float cost_stay_here = path[swb][0].cost; + float cost_get_here = next_minrd + run_bits + 4; + if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run] + != run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1]) + cost_stay_here += run_bits; + if (cost_get_here < cost_stay_here) { + path[swb+1][0].prev_idx = next_mincb; + path[swb+1][0].cost = cost_get_here; + path[swb+1][0].run = 1; + } else { + path[swb+1][0].prev_idx = 0; + path[swb+1][0].cost = cost_stay_here; + path[swb+1][0].run = path[swb][0].run + 1; + } + next_minrd = path[swb+1][0].cost; + next_mincb = 0; + for (cb = 1; cb < 12; cb++) { + path[swb+1][cb].cost = 61450; + path[swb+1][cb].prev_idx = -1; + path[swb+1][cb].run = 0; } } else { float minrd = next_minrd; -- cgit v1.1 From 1bb52045d3a6eb3fa35dbe8c9775ae07329e4cd6 Mon Sep 17 00:00:00 2001 From: Nathan Caldwell Date: Sun, 19 Jun 2011 22:29:37 -0600 Subject: aacenc: Save channel configuration for later use. --- libavcodec/aacenc.c | 16 ++++++++-------- libavcodec/aacenc.h | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index e8942a1..8c7ed87 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -199,8 +199,9 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) ff_init_ff_sine_windows(10); ff_init_ff_sine_windows(7); + s->chan_map = aac_chan_configs[avctx->channels-1]; s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0])); - s->cpe = av_mallocz(sizeof(ChannelElement) * aac_chan_configs[avctx->channels-1][0]); + s->cpe = av_mallocz(sizeof(ChannelElement) * s->chan_map[0]); avctx->extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE); avctx->extradata_size = 5; put_audio_specific_config(avctx); @@ -491,7 +492,6 @@ static int aac_encode_frame(AVCodecContext *avctx, int16_t *samples = s->samples, *samples2, *la; ChannelElement *cpe; int i, ch, w, g, chans, tag, start_ch; - const uint8_t *chan_map = aac_chan_configs[avctx->channels-1]; int chan_el_counter[4]; FFPsyWindowInfo windows[AAC_MAX_CHANNELS]; @@ -504,8 +504,8 @@ static int aac_encode_frame(AVCodecContext *avctx, } else { start_ch = 0; samples2 = s->samples + 1024 * avctx->channels; - for (i = 0; i < chan_map[0]; i++) { - tag = chan_map[i+1]; + for (i = 0; i < s->chan_map[0]; i++) { + tag = s->chan_map[i+1]; chans = tag == TYPE_CPE ? 2 : 1; ff_psy_preprocess(s->psypp, (uint16_t*)data + start_ch, samples2 + start_ch, start_ch, chans); @@ -520,9 +520,9 @@ static int aac_encode_frame(AVCodecContext *avctx, } start_ch = 0; - for (i = 0; i < chan_map[0]; i++) { + for (i = 0; i < s->chan_map[0]; i++) { FFPsyWindowInfo* wi = windows + start_ch; - tag = chan_map[i+1]; + tag = s->chan_map[i+1]; chans = tag == TYPE_CPE ? 2 : 1; cpe = &s->cpe[i]; for (ch = 0; ch < chans; ch++) { @@ -562,9 +562,9 @@ static int aac_encode_frame(AVCodecContext *avctx, put_bitstream_info(avctx, s, LIBAVCODEC_IDENT); start_ch = 0; memset(chan_el_counter, 0, sizeof(chan_el_counter)); - for (i = 0; i < chan_map[0]; i++) { + for (i = 0; i < s->chan_map[0]; i++) { FFPsyWindowInfo* wi = windows + start_ch; - tag = chan_map[i+1]; + tag = s->chan_map[i+1]; chans = tag == TYPE_CPE ? 2 : 1; cpe = &s->cpe[i]; put_bits(&s->pb, 3, tag); diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h index 067a9b0..3f590fe 100644 --- a/libavcodec/aacenc.h +++ b/libavcodec/aacenc.h @@ -61,6 +61,7 @@ typedef struct AACEncContext { int16_t *samples; ///< saved preprocessed input int samplerate_index; ///< MPEG-4 samplerate index + uint8_t *chan_map; ///< channel configuration map ChannelElement *cpe; ///< channel elements FFPsyContext psy; -- cgit v1.1 From d2ee495fb241fa4ef5b8b56161328c4379d1c79a Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 22 Jun 2011 23:30:15 +0200 Subject: configure: Drop check for availability of ten assembler operands. This was done to support gcc 2.95, which is an old legacy compiler that fails to compile the current codebase anyway. --- libavcodec/x86/dsputil_mmx.c | 4 ++-- libavcodec/x86/mlpdsp.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 5c5ecb2..4d4bbc5 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -602,7 +602,7 @@ static void add_bytes_l2_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ dst[i] = src1[i] + src2[i]; } -#if HAVE_7REGS && HAVE_TEN_OPERANDS +#if HAVE_7REGS static void add_hfyu_median_prediction_cmov(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top) { x86_reg w2 = -w; x86_reg x; @@ -2674,7 +2674,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_mmx2; #endif -#if HAVE_7REGS && HAVE_TEN_OPERANDS +#if HAVE_7REGS if( mm_flags&AV_CPU_FLAG_3DNOW ) c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov; #endif diff --git a/libavcodec/x86/mlpdsp.c b/libavcodec/x86/mlpdsp.c index 333dc56..400855d 100644 --- a/libavcodec/x86/mlpdsp.c +++ b/libavcodec/x86/mlpdsp.c @@ -23,7 +23,7 @@ #include "libavcodec/dsputil.h" #include "libavcodec/mlp.h" -#if HAVE_7REGS && HAVE_TEN_OPERANDS +#if HAVE_7REGS extern void ff_mlp_firorder_8; extern void ff_mlp_firorder_7; @@ -171,11 +171,11 @@ static void mlp_filter_channel_x86(int32_t *state, const int32_t *coeff, ); } -#endif /* HAVE_7REGS && HAVE_TEN_OPERANDS */ +#endif /* HAVE_7REGS */ void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx) { -#if HAVE_7REGS && HAVE_TEN_OPERANDS +#if HAVE_7REGS c->mlp_filter_channel = mlp_filter_channel_x86; #endif } -- cgit v1.1 From bb00b15f9e4e3c56abf628ed2cb9bfa8965e2bf8 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 27 Jun 2011 00:42:55 +0200 Subject: avutil: Remove unused arbitrary precision integer code. --- libavcodec/utils.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libavcodec') diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 146dd30..4e15f6f 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -26,7 +26,6 @@ */ #include "libavutil/avstring.h" -#include "libavutil/integer.h" #include "libavutil/crc.h" #include "libavutil/pixdesc.h" #include "libavutil/audioconvert.h" -- cgit v1.1 From bd2deab706bba303e15fb43e91f46a9f7840aba6 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 23 Jun 2011 14:26:34 -0400 Subject: cosmetics: remove outdated comment that is no longer true --- libavcodec/ac3enc.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 44dfce8..809a3f5 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -306,8 +306,6 @@ static av_cold void exponent_init(AC3EncodeContext *s) /** * Extract exponents from the MDCT coefficients. - * This takes into account the normalization that was done to the input samples - * by adjusting the exponents by the exponent shift values. */ static void extract_exponents(AC3EncodeContext *s) { -- cgit v1.1 From 57b4a3dd2b358b2122736af861c1538acd1eed1a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 28 Jun 2011 17:08:00 +0100 Subject: build: include sub-makefiles using full path instead of symlinks Signed-off-by: Mans Rullgard --- libavcodec/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 64a2862..b781ed7 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -649,7 +649,7 @@ OBJS-$(CONFIG_MLIB) += mlib/dsputil_mlib.o \ # well. OBJS-$(!CONFIG_SMALL) += inverse.o --include $(SUBDIR)$(ARCH)/Makefile +-include $(SRC_PATH)/$(SUBDIR)$(ARCH)/Makefile SKIPHEADERS += %_tablegen.h \ %_tables.h \ @@ -678,7 +678,7 @@ DIRS = alpha arm bfin mlib ppc ps2 sh4 sparc x86 CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) -include $(SUBDIR)../subdir.mak +include $(SRC_PATH)/subdir.mak $(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o -- cgit v1.1