[FFmpeg-cvslog] MAINTAINERS: Add Manojkumar Bhosale for MIPS, remove myself.
ffmpeg | branch: master | Nedeljko Babic | Wed Jun 7 15:25:51 2017 +0200| [c8e7fc8d9ad70d6641eed1594497c87a9f9b81ff] | committer: Michael Niedermayer MAINTAINERS: Add Manojkumar Bhosale for MIPS, remove myself. Manojkumar is taking over MIPS maintenance. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c8e7fc8d9ad70d6641eed1594497c87a9f9b81ff --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 32408e605d..60aae12faa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -514,7 +514,7 @@ Operating systems / CPU architectures = Alpha Falk Hueffner -MIPS Nedeljko Babic +MIPSManojkumar Bhosale Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier Amiga / PowerPC Colin Ward Windows MinGW Alex Beregszaszi, Ramiro Polla ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mips/aaccoder_mips: Sync with the generic code
ffmpeg | branch: master | Nedeljko Babic | Tue Oct 13 16:14:51 2015 +0200| [de262d018d7d7d9c967af1dfd1b861c4b9eb2a60] | committer: Michael Niedermayer avcodec/mips/aaccoder_mips: Sync with the generic code This patch fixes build of AAC encoder optimized for mips that was broken due to some changes in generic code that were not propagated to the optimized code. Also, some functions in the optimized code are basically duplicate of functions from generic code. Since they do not bring enough improvement to the optimized code to justify their existence, they are removed (which improves maintainability of the optimized code). Optimizations disabled in 97437bd are enabled again. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=de262d018d7d7d9c967af1dfd1b861c4b9eb2a60 --- libavcodec/mips/aaccoder_mips.c | 134 +-- 1 file changed, 3 insertions(+), 131 deletions(-) diff --git a/libavcodec/mips/aaccoder_mips.c b/libavcodec/mips/aaccoder_mips.c index 53de94c..e8e1e62 100644 --- a/libavcodec/mips/aaccoder_mips.c +++ b/libavcodec/mips/aaccoder_mips.c @@ -63,6 +63,7 @@ #include "libavcodec/aacenc.h" #include "libavcodec/aactab.h" #include "libavcodec/aacenctab.h" +#include "libavcodec/aacenc_utils.h" #if HAVE_INLINE_ASM typedef struct BandCodingPath { @@ -130,62 +131,6 @@ static const uint8_t esc_sign_bits[289] = { 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; -#define ROUND_STANDARD 0.4054f -#define ROUND_TO_ZERO 0.1054f - -static void abs_pow34_v(float *out, const float *in, const int size) { -#ifndef USE_REALLY_FULL_SEARCH -int i; -float a, b, c, d; -float ax, bx, cx, dx; - -for (i = 0; i < size; i += 4) { -a = fabsf(in[i ]); -b = fabsf(in[i+1]); -c = fabsf(in[i+2]); -d = fabsf(in[i+3]); - -ax = sqrtf(a); -bx = sqrtf(b); -cx = sqrtf(c); -dx = sqrtf(d); - -a = a * ax; -b = b * bx; -c = c * cx; -d = d * dx; - -out[i ] = sqrtf(a); -out[i+1] = sqrtf(b); -out[i+2] = sqrtf(c); -out[i+3] = sqrtf(d); -} -#endif /* USE_REALLY_FULL_SEARCH */ -} - -static float find_max_val(int group_len, int swb_size, const float *scaled) { -float maxval = 0.0f; -int w2, i; -for (w2 = 0; w2 < group_len; w2++) { -for (i = 0; i < swb_size; i++) { -maxval = FFMAX(maxval, scaled[w2*128+i]); -} -} -return maxval; -} - -static int find_min_book(float maxval, int sf) { -float Q = ff_aac_pow2sf_tab[POW_SF2_ZERO - sf + SCALE_ONE_POS - SCALE_DIV_512]; -float Q34 = sqrtf(Q * sqrtf(Q)); -int qmaxval, cb; -qmaxval = maxval * Q34 + 0.4054f; -if (qmaxval >= (FF_ARRAY_ELEMS(aac_maxval_cb))) -cb = 11; -else -cb = aac_maxval_cb[qmaxval]; -return cb; -} - /** * Functions developed from template function and optimized for quantizing and encoding band */ @@ -860,7 +805,6 @@ static void quantize_and_encode_band_cost_ESC_mips(struct AACEncContext *s, unsigned int v_codes; int c1, c2, c3, c4; int t0, t1, t2, t3, t4; -const float *vec1, *vec2; qc1 = scaled[i ] * Q34 + ROUNDING; qc2 = scaled[i+1] * Q34 + ROUNDING; @@ -965,8 +909,6 @@ static void quantize_and_encode_band_cost_ESC_mips(struct AACEncContext *s, if (out || energy) { float e1, e2, e3, e4; -vec1 = &p_vectors[curidx*2]; -vec2 = &p_vectors[curidx2*2]; e1 = copysignf(c1 * cbrtf(c1) * IQ, in[i+0]); e2 = copysignf(c2 * cbrtf(c2) * IQ, in[i+1]); e3 = copysignf(c3 * cbrtf(c3) * IQ, in[i+2]); @@ -2390,76 +2332,6 @@ static float quantize_band_cost(struct AACEncContext *s, const float *in, #include "libavcodec/aacenc_quantization_misc.h" -static float find_form_factor(int group_len, int swb_size, float thresh, const float *scaled, float nzslope) { -const float iswb_size = 1.0f / swb_size; -const float iswb_sizem1 = 1.0f / (swb_size - 1); -const float ethresh = thresh, iethresh = 1.0f / ethresh; -float form = 0.0f, weight = 0.0f; -int w2, i; -for (w2 = 0; w2 < group_len; w2++) { -float e = 0.0f, e2 = 0.0f, var = 0.0f, maxval = 0.0f; -float nzl = 0; -for (i = 0; i < swb_size; i+=4) { -float s1 = fabsf(scaled[w2*128+i ]); -float s2 = fabsf(scaled[w2*128+i+1]); -float s3 = fabsf(scaled[w2*128+i+2]); -float s4 = fabsf(scaled[w2*128+i+3]); -maxval = FFMAX(maxval, FFMAX(FFMAX(s1, s2), FFMAX(s3, s4))); -e += (s1+s2)+(s3+s4); -s1 *= s1; -s2 *= s2; -s3 *= s3; -s4 *= s4; -e2 += (
[FFmpeg-cvslog] avcodec/mips/aaccoder_mips: Sync with generic aaccoder file.
ffmpeg | branch: master | Nedeljko Babic | Fri Sep 11 15:16:16 2015 +0200| [b65ffa316e377213c29736929beba584d0d80d7c] | committer: Michael Niedermayer avcodec/mips/aaccoder_mips: Sync with generic aaccoder file. Code in aaccoder_mips.c was not synced with changes in aaccoder.c for some time. That was cause for some fate-aac tests failing. This patch fixes the problems. Optimizations disabled in 933309a are enabled again. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b65ffa316e377213c29736929beba584d0d80d7c --- libavcodec/mips/aaccoder_mips.c | 89 +-- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/libavcodec/mips/aaccoder_mips.c b/libavcodec/mips/aaccoder_mips.c index d22cb5e..a7ed7fa 100644 --- a/libavcodec/mips/aaccoder_mips.c +++ b/libavcodec/mips/aaccoder_mips.c @@ -61,6 +61,7 @@ #include "libavcodec/put_bits.h" #include "libavcodec/aac.h" #include "libavcodec/aacenc.h" +#include "libavcodec/aacenctab.h" #include "libavcodec/aactab.h" #if HAVE_INLINE_ASM @@ -70,21 +71,6 @@ typedef struct BandCodingPath { int run; } BandCodingPath; -static const uint8_t run_value_bits_long[64] = { - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, -10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, -10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 15 -}; - -static const uint8_t run_value_bits_short[16] = { -3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 9 -}; - -static const uint8_t * const run_value_bits[2] = { -run_value_bits_long, run_value_bits_short -}; - static const uint8_t uquad_sign_bits[81] = { 0, 1, 1, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 3, 3, 2, 3, 3, @@ -2200,22 +2186,27 @@ static void search_for_quantizers_twoloop_mips(AVCodecContext *avctx, const float lambda) { int start = 0, i, w, w2, g; -int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels; -float dists[128] = { 0 }, uplims[128]; +int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f); +float dists[128] = { 0 }, uplims[128] = { 0 }; float maxvals[128]; int fflag, minscaler; int its = 0; int allz = 0; float minthr = INFINITY; +// for values above this the decoder might end up in an endless loop +// due to always having more bits than what can be encoded. destbits = FFMIN(destbits, 5800); +//XXX: some heuristic to determine initial quantizers will reduce search time +//determine zero bands and upper limits for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { for (g = 0; g < sce->ics.num_swb; g++) { int nz = 0; -float uplim = 0.0f; +float uplim = 0.0f, energy = 0.0f; for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g]; -uplim += band->threshold; +uplim += band->threshold; +energy += band->energy; if (band->energy <= band->threshold || band->threshold == 0.0f) { sce->zeroes[(w+w2)*16+g] = 1; continue; @@ -2252,9 +2243,12 @@ static void search_for_quantizers_twoloop_mips(AVCodecContext *avctx, } } +//perform two-loop search +//outer loop - improve quality do { int tbits, qstep; minscaler = sce->sf_idx[0]; +//inner loop - quantize spectrum to fit into given number of bits qstep = its ? 1 : 32; do { int prev = -1; @@ -2350,13 +2344,14 @@ static void search_for_quantizers_twoloop_mips(AVCodecContext *avctx, fflag = 0; minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF); + for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { for (g = 0; g < sce->ics.num_swb; g++) { int prevsc = sce->sf_idx[w*16+g]; if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) { if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1)) sce->sf_idx[w*16+g]--; -else +else //Try to make sure there is some energy in every band sce->sf_idx[w*16+g]-=2; } sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF); @@ -2375,11 +2370,13 @@ static void search_for_ms_mips(AACEncContext *s, ChannelElement *cp
[FFmpeg-cvslog] avcodec/aacdec_fixed: Fix preparation for resampler
ffmpeg | branch: master | Nedeljko Babic | Wed Jul 29 16:46:18 2015 +0200| [902bfa5b22083f4959de775e2f8f278785d6ff02] | committer: Michael Niedermayer avcodec/aacdec_fixed: Fix preparation for resampler 2nd channel makes sense only for CPE type. Skip 2nd channel in preparation for resampler (in spectral_to _sample()) depending on block type. Fixes fate failure with clang ftrapv. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=902bfa5b22083f4959de775e2f8f278785d6ff02 --- libavcodec/aacdec_template.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 13653a8..2f270bc 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -2750,7 +2750,8 @@ static void spectral_to_sample(AACContext *ac, int samples) /* preparation for resampler */ for(j = 0; jch[0].ret[j] = (int32_t)av_clipl_int32((int64_t)che->ch[0].ret[j]<<7)+0x8000; -che->ch[1].ret[j] = (int32_t)av_clipl_int32((int64_t)che->ch[1].ret[j]<<7)+0x8000; +if(type == TYPE_CPE) +che->ch[1].ret[j] = (int32_t)av_clipl_int32((int64_t)che->ch[1].ret[j]<<7)+0x8000; } } #endif /* USE_FIXED */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/aac_fixed: Fix a bug in spectral_to_sample()
ffmpeg | branch: master | Nedeljko Babic | Tue Jul 28 17:40:23 2015 +0200| [fee7c42bf45f72d457fafaee536f054ce59e4ec5] | committer: Michael Niedermayer avcodec/aac_fixed: Fix a bug in spectral_to_sample() There was fixed number of loops (2048) in preparation for resampler, so when number of samples is smaller than this, there would be an overflow on ret_buf. For some reason this behavior popped out only under valgrind with --disable-memory-poisoning option. This is now fixed and number of loops depends on actual number of samples. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fee7c42bf45f72d457fafaee536f054ce59e4ec5 --- libavcodec/aacdec_template.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index e29c803..13653a8 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -2694,7 +2694,7 @@ static void apply_channel_coupling(AACContext *ac, ChannelElement *cc, /** * Convert spectral data to samples, applying all supported tools as appropriate. */ -static void spectral_to_sample(AACContext *ac) +static void spectral_to_sample(AACContext *ac, int samples) { int i, type; void (*imdct_and_window)(AACContext *ac, SingleChannelElement *sce); @@ -2748,7 +2748,7 @@ static void spectral_to_sample(AACContext *ac) { int j; /* preparation for resampler */ -for(j = 0; j<2048; j++){ +for(j = 0; jch[0].ret[j] = (int32_t)av_clipl_int32((int64_t)che->ch[0].ret[j]<<7)+0x8000; che->ch[1].ret[j] = (int32_t)av_clipl_int32((int64_t)che->ch[1].ret[j]<<7)+0x8000; } @@ -2881,7 +2881,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data, return err; } -spectral_to_sample(ac); +spectral_to_sample(ac, samples); ac->frame->nb_samples = samples; ac->frame->sample_rate = avctx->sample_rate; @@ -3029,11 +3029,11 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, return 0; } -spectral_to_sample(ac); - multiplier = (ac->oc[1].m4ac.sbr == 1) ? ac->oc[1].m4ac.ext_sample_rate > ac->oc[1].m4ac.sample_rate : 0; samples <<= multiplier; +spectral_to_sample(ac, samples); + if (ac->oc[1].status && audio_found) { avctx->sample_rate = ac->oc[1].m4ac.sample_rate << multiplier; avctx->frame_size = samples; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavutil/softfloat: Fix av_normalize1_sf bias.
ffmpeg | branch: release/2.5 | Nedeljko Babic | Wed Jun 3 16:17:39 2015 +0200| [3dd5c6a4ba805f7b6c4c80897571cb14b9aa4496] | committer: Michael Niedermayer libavutil/softfloat: Fix av_normalize1_sf bias. av_normalize1_sf doesn't properly address border case when mantis is exactly -0x4000. Signed-off-by: Michael Niedermayer (cherry picked from commit 7131aba916d1f562bdaf6a81319f1421ce175b1e) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3dd5c6a4ba805f7b6c4c80897571cb14b9aa4496 --- libavutil/softfloat.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h index 8647e6a..a487c34 100644 --- a/libavutil/softfloat.h +++ b/libavutil/softfloat.h @@ -59,7 +59,7 @@ static av_const SoftFloat av_normalize_sf(SoftFloat a){ static inline av_const SoftFloat av_normalize1_sf(SoftFloat a){ #if 1 -if((int32_t)(a.mant + 0x4000U) < 0){ +if((int32_t)(a.mant + 0x4000U) <= 0){ a.exp++; a.mant>>=1; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec: Minor macro polishing
ffmpeg | branch: master | Nedeljko Babic | Mon Jul 20 13:36:20 2015 +0200| [a9d986c2ced87d074ba307f9d6f213c5caae88ee] | committer: Michael Niedermayer avcodec: Minor macro polishing Use macros from aac_defines.h for adding suffixes instead of local macros. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9d986c2ced87d074ba307f9d6f213c5caae88ee --- libavcodec/cbrt_tablegen.h |5 ++--- libavcodec/cbrt_tablegen_template.c|2 +- libavcodec/sinewin.h | 17 + libavcodec/sinewin_tablegen.h | 21 + libavcodec/sinewin_tablegen_template.c | 14 -- 5 files changed, 21 insertions(+), 38 deletions(-) diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h index 07ef392..27a3e3a 100644 --- a/libavcodec/cbrt_tablegen.h +++ b/libavcodec/cbrt_tablegen.h @@ -26,12 +26,11 @@ #include #include #include "libavutil/attributes.h" +#include "libavcodec/aac_defines.h" #if USE_FIXED -#define CBRT_RENAME(a) a ## _fixed #define CBRT(x) (int)floor((x).f * 8192 + 0.5) #else -#define CBRT_RENAME(a) a #define CBRT(x) x.i #endif @@ -46,7 +45,7 @@ #else static uint32_t cbrt_tab[1 << 13]; -static av_cold void CBRT_RENAME(cbrt_tableinit)(void) +static av_cold void AAC_RENAME(cbrt_tableinit)(void) { if (!cbrt_tab[(1<<13) - 1]) { int i; diff --git a/libavcodec/cbrt_tablegen_template.c b/libavcodec/cbrt_tablegen_template.c index a8c0495..9dd2cf5 100644 --- a/libavcodec/cbrt_tablegen_template.c +++ b/libavcodec/cbrt_tablegen_template.c @@ -27,7 +27,7 @@ int main(void) { -CBRT_RENAME(cbrt_tableinit)(); +AAC_RENAME(cbrt_tableinit)(); write_fileheader(); diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h index 5f0a74a..27c107c 100644 --- a/libavcodec/sinewin.h +++ b/libavcodec/sinewin.h @@ -23,6 +23,7 @@ #include "config.h" #include "libavutil/mem.h" +#include "libavcodec/aac_defines.h" #if CONFIG_HARDCODED_TABLES # define SINETABLE_CONST const @@ -34,28 +35,20 @@ #define USE_FIXED 0 #endif -#if USE_FIXED -#define SINEWIN_SUFFIX(a) a ## _fixed -#define INTFLOAT int -#else -#define SINEWIN_SUFFIX(a) a -#define INTFLOAT float -#endif - #define SINETABLE(size) \ -SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, SINEWIN_SUFFIX(ff_sine_##size))[size] +SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, AAC_RENAME(ff_sine_##size))[size] /** * Generate a sine window. * @param window pointer to half window * @param n size of half window */ -void SINEWIN_SUFFIX(ff_sine_window_init)(INTFLOAT *window, int n); +void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n); /** * initialize the specified entry of ff_sine_windows */ -void SINEWIN_SUFFIX(ff_init_ff_sine_windows)(int index); +void AAC_RENAME(ff_init_ff_sine_windows)(int index); extern SINETABLE( 32); extern SINETABLE( 64); @@ -67,6 +60,6 @@ extern SINETABLE(2048); extern SINETABLE(4096); extern SINETABLE(8192); -extern SINETABLE_CONST INTFLOAT * const SINEWIN_SUFFIX(ff_sine_windows)[14]; +extern SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[14]; #endif /* AVCODEC_SINEWIN_H */ diff --git a/libavcodec/sinewin_tablegen.h b/libavcodec/sinewin_tablegen.h index e1623b4..4432135 100644 --- a/libavcodec/sinewin_tablegen.h +++ b/libavcodec/sinewin_tablegen.h @@ -27,6 +27,7 @@ // 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 #include +#include "libavcodec/aac_defines.h" #include "libavutil/attributes.h" #include "libavutil/common.h" @@ -49,33 +50,29 @@ SINETABLE(8192); #endif #if USE_FIXED -#define SINEWIN_SUFFIX(a) a ## _fixed -#define INTFLOAT int #define SIN_FIX(a) (int)floor((a) * 0x8000 + 0.5) #else -#define SINEWIN_SUFFIX(a) a -#define INTFLOAT float #define SIN_FIX(a) a #endif -SINETABLE_CONST INTFLOAT * const SINEWIN_SUFFIX(ff_sine_windows)[] = { +SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[] = { NULL, NULL, NULL, NULL, NULL, // unused -SINEWIN_SUFFIX(ff_sine_32) , SINEWIN_SUFFIX(ff_sine_64), SINEWIN_SUFFIX(ff_sine_128), -SINEWIN_SUFFIX(ff_sine_256), SINEWIN_SUFFIX(ff_sine_512), SINEWIN_SUFFIX(ff_sine_1024), -SINEWIN_SUFFIX(ff_sine_2048), SINEWIN_SUFFIX(ff_sine_4096), SINEWIN_SUFFIX(ff_sine_8192) +AAC_RENAME(ff_sine_32) , AAC_RENAME(ff_sine_64), AAC_RENAME(ff_sine_128), +AAC_RENAME(ff_sine_256), AAC_RENAME(ff_sine_512), AAC_RENAME(ff_sine_1024), +AAC_RENAME(ff_sine_2048), AAC_RENAME(ff_sine_4096), AAC_RENAME(ff_sine_8192) }; // Generate a sine window. -av_cold void SINEWIN_SUFFIX(ff_sine_window_init)(INTFLOAT *window, int n) { +av_cold void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n) { in
[FFmpeg-cvslog] tests: Add aac_fixed decoder test
ffmpeg | branch: master | Nedeljko Babic | Mon Jul 20 13:36:21 2015 +0200| [978a8540b6ced36f948a43c2671ee4c27ff5deb1] | committer: Michael Niedermayer tests: Add aac_fixed decoder test Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=978a8540b6ced36f948a43c2671ee4c27ff5deb1 --- tests/fate/aac.mak | 58 +++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak index 34823be..7ebec45 100644 --- a/tests/fate/aac.mak +++ b/tests/fate/aac.mak @@ -70,6 +70,61 @@ FATE_AAC += fate-aac-er_eld2100np_48_ep0 fate-aac-er_eld2100np_48_ep0: CMD = pcm -i $(TARGET_SAMPLES)/aac/er_eld2100np_48_ep0.mp4 fate-aac-er_eld2100np_48_ep0: REF = $(SAMPLES)/aac/er_eld2100np_48.s16 +FATE_AAC_FIXED += fate-aac-fixed-al04_44 +fate-aac-fixed-al04_44: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/al04_44.mp4 +fate-aac-fixed-al04_44: REF = $(SAMPLES)/aac/al04_44.s16 + +FATE_AAC_FIXED += fate-aac-fixed-al05_44 +fate-aac-fixed-al05_44: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/al05_44.mp4 +fate-aac-fixed-al05_44: REF = $(SAMPLES)/aac/al05_44.s16 + +FATE_AAC_FIXED += fate-aac-fixed-al06_44 +fate-aac-fixed-al06_44: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/al06_44.mp4 +fate-aac-fixed-al06_44: REF = $(SAMPLES)/aac/al06_44_reorder.s16 + +FATE_AAC_FIXED += fate-aac-fixed-al15_44 +fate-aac-fixed-al15_44: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/al15_44.mp4 +fate-aac-fixed-al15_44: REF = $(SAMPLES)/aac/al15_44_reorder.s16 + +FATE_AAC_FIXED += fate-aac-fixed-al17_44 +fate-aac-fixed-al17_44: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/al17_44.mp4 +fate-aac-fixed-al17_44: REF = $(SAMPLES)/aac/al17_44.s16 + +FATE_AAC_FIXED += fate-aac-fixed-al18_44 +fate-aac-fixed-al18_44: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/al18_44.mp4 +fate-aac-fixed-al18_44: REF = $(SAMPLES)/aac/al18_44.s16 + +FATE_AAC_FIXED += fate-aac-fixed-al_sbr_hq_cm_48_2 +fate-aac-fixed-al_sbr_hq_cm_48_2: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/al_sbr_cm_48_2.mp4 +fate-aac-fixed-al_sbr_hq_cm_48_2: REF = $(SAMPLES)/aac/al_sbr_hq_cm_48_2.s16 + +FATE_AAC_FIXED += fate-aac-fixed-al_sbr_hq_cm_48_5.1 +fate-aac-fixed-al_sbr_hq_cm_48_5.1: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/al_sbr_cm_48_5.1.mp4 +fate-aac-fixed-al_sbr_hq_cm_48_5.1: REF = $(SAMPLES)/aac/al_sbr_hq_cm_48_5.1_reorder.s16 + +FATE_AAC_FIXED += fate-aac-fixed-al_sbr_hq_sr_48_2_fsaac48 +fate-aac-fixed-al_sbr_hq_sr_48_2_fsaac48: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/al_sbr_sr_48_2_fsaac48.mp4 +fate-aac-fixed-al_sbr_hq_sr_48_2_fsaac48: REF = $(SAMPLES)/aac/al_sbr_hq_sr_48_2_fsaac48.s16 + +#FATE_AAC_FIXED += fate-aac-fixed-al_sbr_ps_06_ur +#fate-aac-fixed-al_sbr_ps_06_ur: CMD = pcm -c aac_fixed-i $(TARGET_SAMPLES)/aac/al_sbr_ps_06_new.mp4 +#fate-aac-fixed-al_sbr_ps_06_ur: REF = $(SAMPLES)/aac/al_sbr_ps_06_ur.s16 + +FATE_AAC_FIXED += fate-aac-fixed-ap05_48 +fate-aac-fixed-ap05_48: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/ap05_48.mp4 +fate-aac-fixed-ap05_48: REF = $(SAMPLES)/aac/ap05_48.s16 + +FATE_AAC_FIXED += fate-aac-fixed-er_ad6000np_44_ep0 +fate-aac-fixed-er_ad6000np_44_ep0: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/er_ad6000np_44_ep0.mp4 +fate-aac-fixed-er_ad6000np_44_ep0: REF = $(SAMPLES)/aac/er_ad6000np_44.s16 + +FATE_AAC_FIXED += fate-aac-fixed-er_eld1001np_44_ep0 +fate-aac-fixed-er_eld1001np_44_ep0: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/er_eld1001np_44_ep0.mp4 +fate-aac-fixed-er_eld1001np_44_ep0: REF = $(SAMPLES)/aac/er_eld1001np_44.s16 + +FATE_AAC_FIXED += fate-aac-fixed-er_eld2000np_48_ep0 +fate-aac-fixed-er_eld2000np_48_ep0: CMD = pcm -c aac_fixed -i $(TARGET_SAMPLES)/aac/er_eld2000np_48_ep0.mp4 +fate-aac-fixed-er_eld2000np_48_ep0: REF = $(SAMPLES)/aac/er_eld2000np_48_ep0.s16 fate-aac-ct%: CMD = pcm -i $(TARGET_SAMPLES)/aac/CT_DecoderCheck/$(@:fate-aac-ct-%=%) fate-aac-ct%: REF = $(SAMPLES)/aac/CT_DecoderCheck/aacPlusv2.wav @@ -114,8 +169,9 @@ fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16 FATE_AAC-$(call DEMDEC, AAC,AAC) += $(FATE_AAC_CT_RAW) FATE_AAC-$(call DEMDEC, MOV,AAC) += $(FATE_AAC) FATE_AAC_LATM-$(call DEMDEC, MPEGTS, AAC_LATM) += $(FATE_AAC_LATM) +FATE_AAC-$(call DEMDEC, AAC,AAC_FIXED)+= $(FATE_AAC_FIXED) -FATE_AAC_ALL = $(FATE_AAC-yes) $(FATE_AAC_LATM-yes) +FATE_AAC_ALL = $(FATE_AAC-yes) $(FATE_AAC_LATM-yes) $(FATE_AAC_FIXED-yes) $(FATE_AAC_ALL): CMP = oneoff $(FATE_AAC_ALL): FUZZ = 2 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavutil/softfloat: Fix av_normalize1_sf bias.
ffmpeg | branch: release/2.6 | Nedeljko Babic | Wed Jun 3 16:17:39 2015 +0200| [c8377cc49b2fe1d97836e1f8df4c3490b07612d1] | committer: Michael Niedermayer libavutil/softfloat: Fix av_normalize1_sf bias. av_normalize1_sf doesn't properly address border case when mantis is exactly -0x4000. Signed-off-by: Michael Niedermayer (cherry picked from commit 7131aba916d1f562bdaf6a81319f1421ce175b1e) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c8377cc49b2fe1d97836e1f8df4c3490b07612d1 --- libavutil/softfloat.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h index 8647e6a..a487c34 100644 --- a/libavutil/softfloat.h +++ b/libavutil/softfloat.h @@ -59,7 +59,7 @@ static av_const SoftFloat av_normalize_sf(SoftFloat a){ static inline av_const SoftFloat av_normalize1_sf(SoftFloat a){ #if 1 -if((int32_t)(a.mant + 0x4000U) < 0){ +if((int32_t)(a.mant + 0x4000U) <= 0){ a.exp++; a.mant>>=1; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavutil/doc: Changes in documentation due to changes to fixed_dsp
ffmpeg | branch: master | Nedeljko Babic | Fri Jun 5 11:54:44 2015 +0200| [19ed3e35a5cd188de69f3635f56d9e51c2f720d5] | committer: Michael Niedermayer libavutil/doc: Changes in documentation due to changes to fixed_dsp New functions are added to fixed_dsp, so the documentation is changed accordingly. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=19ed3e35a5cd188de69f3635f56d9e51c2f720d5 --- doc/APIchanges |7 +++ libavutil/version.h |4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 5c36dca..6724d20 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,13 @@ libavutil: 2014-08-09 API changes, most recent first: +2015-06-05 - xxx - lavu 54.27.100 - fixed_dsp.h + Add vector_fmul() + Add vector_fmul_reverse() + Add vector_fmul_add() + Add scalarproduct_fixed() + Add butterflies_fixed() + 2015-06-04 - xxx - lswr 1.2.100 Add swr_get_out_samples() diff --git a/libavutil/version.h b/libavutil/version.h index 5306c21..215729e 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -56,8 +56,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 54 -#define LIBAVUTIL_VERSION_MINOR 26 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MINOR 27 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavutil/softfloat: Fix av_normalize1_sf bias.
ffmpeg | branch: master | Nedeljko Babic | Wed Jun 3 16:17:39 2015 +0200| [7131aba916d1f562bdaf6a81319f1421ce175b1e] | committer: Michael Niedermayer libavutil/softfloat: Fix av_normalize1_sf bias. av_normalize1_sf doesn't properly address border case when mantis is exactly -0x4000. Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7131aba916d1f562bdaf6a81319f1421ce175b1e --- libavutil/softfloat.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h index d6cfc3c..6aecdf3 100644 --- a/libavutil/softfloat.h +++ b/libavutil/softfloat.h @@ -60,7 +60,7 @@ static av_const SoftFloat av_normalize_sf(SoftFloat a){ static inline av_const SoftFloat av_normalize1_sf(SoftFloat a){ #if 1 -if((int32_t)(a.mant + 0x4000U) < 0){ +if((int32_t)(a.mant + 0x4000U) <= 0){ a.exp++; a.mant>>=1; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavutil: Add new fixed dsp functions.
ffmpeg | branch: master | Nedeljko Babic | Wed Jun 3 16:00:36 2015 +0200| [1a06d0935fb2be5925a073fb4fee3452e431f279] | committer: Michael Niedermayer libavutil: Add new fixed dsp functions. Add functions needed for implementation of fixed point aac dec. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1a06d0935fb2be5925a073fb4fee3452e431f279 --- libavutil/fixed_dsp.c | 62 + libavutil/fixed_dsp.h | 59 ++ 2 files changed, 121 insertions(+) diff --git a/libavutil/fixed_dsp.c b/libavutil/fixed_dsp.c index e0ea981..8b25156 100644 --- a/libavutil/fixed_dsp.c +++ b/libavutil/fixed_dsp.c @@ -47,6 +47,28 @@ #include "fixed_dsp.h" +static void vector_fmul_add_c(int *dst, const int *src0, const int *src1, const int *src2, int len){ +int i; +int64_t accu; + +for (i=0; i> 31); +} +} + +static void vector_fmul_reverse_c(int *dst, const int *src0, const int *src1, int len) +{ +int i; +int64_t accu; + +src1 += len-1; +for (i=0; i> 31); +} +} + static void vector_fmul_window_scaled_c(int16_t *dst, const int32_t *src0, const int32_t *src1, const int32_t *win, int len, uint8_t bits) @@ -88,6 +110,41 @@ static void vector_fmul_window_c(int32_t *dst, const int32_t *src0, } } +static void vector_fmul_c(int *dst, const int *src0, const int *src1, int len) +{ +int i; +int64_t accu; + +for (i = 0; i < len; i++){ +accu = (int64_t)src0[i] * src1[i]; +dst[i] = (int)((accu+0x4000) >> 31); +} +} + +static int ff_scalarproduct_fixed_c(const int *v1, const int *v2, int len) +{ +/** p is initialized with 0x4000 so that the proper rounding will occur + * at the end */ +int64_t p = 0x4000; +int i; + +for (i = 0; i < len; i++) +p += (int64_t)v1[i] * v2[i]; + +return (int)(p >> 31); +} + +static void butterflies_fixed_c(int *v1, int *v2, int len) +{ +int i; + +for (i = 0; i < len; i++){ +int t = v1[i] - v2[i]; +v1[i] += v2[i]; +v2[i] = t; +} +} + AVFixedDSPContext * avpriv_alloc_fixed_dsp(int bit_exact) { AVFixedDSPContext * fdsp = av_malloc(sizeof(AVFixedDSPContext)); @@ -97,6 +154,11 @@ AVFixedDSPContext * avpriv_alloc_fixed_dsp(int bit_exact) fdsp->vector_fmul_window_scaled = vector_fmul_window_scaled_c; fdsp->vector_fmul_window = vector_fmul_window_c; +fdsp->vector_fmul = vector_fmul_c; +fdsp->vector_fmul_add = vector_fmul_add_c; +fdsp->vector_fmul_reverse = vector_fmul_reverse_c; +fdsp->butterflies_fixed = butterflies_fixed_c; +fdsp->scalarproduct_fixed = ff_scalarproduct_fixed_c; return fdsp; } diff --git a/libavutil/fixed_dsp.h b/libavutil/fixed_dsp.h index ff6f365..03987ad 100644 --- a/libavutil/fixed_dsp.h +++ b/libavutil/fixed_dsp.h @@ -54,8 +54,13 @@ #include "libavcodec/mathops.h" typedef struct AVFixedDSPContext { +/* Assume len is a multiple of 16, and arrays are 32-byte aligned */ +/* Results of multiplications are scaled down by 31 bit (and rounded) if not + * stated otherwise */ + /** * Overlap/add with window function. + * Result is scaled down by "bits" bits. * Used primarily by MDCT-based audio codecs. * Source and destination vectors must overlap exactly or not at all. * @@ -92,6 +97,60 @@ typedef struct AVFixedDSPContext { */ void (*vector_fmul_window)(int32_t *dst, const int32_t *src0, const int32_t *src1, const int32_t *win, int len); +/** + * Fixed-point multiplication that calculates the entry wise product of two + * vectors of integers and stores the result in a vector of integers. + * + * @param dst output vector + * constraints: 32-byte aligned + * @param src0 first input vector + * constraints: 32-byte aligned + * @param src1 second input vector + * constraints: 32-byte aligned + * @param len number of elements in the input + * constraints: multiple of 16 + */ +void (*vector_fmul)(int *dst, const int *src0, const int *src1, +int len); + +void (*vector_fmul_reverse)(int *dst, const int *src0, const int *src1, int len); +/** + * Calculate the entry wise product of two vectors of integers, add a third vector of + * integers and store the result in a vector of integers. + * + * @param dst output vector + * constraints: 32-byte aligned + * @param src0 first input vector + * constraints: 32-byte aligned + * @param src1 second input vector + * constraints: 32-byte aligned + * @param src2 third
[FFmpeg-cvslog] libavutil: Cosmetic changes to fixed_dsp file.
ffmpeg | branch: master | Nedeljko Babic | Fri May 29 15:46:20 2015 +0200| [e374405d8e821e292ebde827d9b30257b0ff75eb] | committer: Michael Niedermayer libavutil: Cosmetic changes to fixed_dsp file. Names of functions vector_fmul_window_fixed_c and vector_fmul_window_fixed_scaled_c are changed by removing "_fixed" from the name since it is redundant. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e374405d8e821e292ebde827d9b30257b0ff75eb --- libavutil/fixed_dsp.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavutil/fixed_dsp.c b/libavutil/fixed_dsp.c index 9f2e841..e0ea981 100644 --- a/libavutil/fixed_dsp.c +++ b/libavutil/fixed_dsp.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * Author: Nedeljko Babic (nba...@mips.com) + * Author: Nedeljko Babic (nedeljko.babic imgtec com) * * This file is part of FFmpeg. * @@ -47,7 +47,7 @@ #include "fixed_dsp.h" -static void vector_fmul_window_fixed_scaled_c(int16_t *dst, const int32_t *src0, +static void vector_fmul_window_scaled_c(int16_t *dst, const int32_t *src0, const int32_t *src1, const int32_t *win, int len, uint8_t bits) { @@ -68,7 +68,7 @@ static void vector_fmul_window_fixed_scaled_c(int16_t *dst, const int32_t *src0, } } -static void vector_fmul_window_fixed_c(int32_t *dst, const int32_t *src0, +static void vector_fmul_window_c(int32_t *dst, const int32_t *src0, const int32_t *src1, const int32_t *win, int len) { @@ -95,8 +95,8 @@ AVFixedDSPContext * avpriv_alloc_fixed_dsp(int bit_exact) if (!fdsp) return NULL; -fdsp->vector_fmul_window_scaled = vector_fmul_window_fixed_scaled_c; -fdsp->vector_fmul_window = vector_fmul_window_fixed_c; +fdsp->vector_fmul_window_scaled = vector_fmul_window_scaled_c; +fdsp->vector_fmul_window = vector_fmul_window_c; return fdsp; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavutil/softfloat: Add test case for av_add_sf
ffmpeg | branch: master | Nedeljko Babic | Thu May 14 15:36:36 2015 +0200| [729466dc68f9166c13be79581ecc8a79411ee885] | committer: Michael Niedermayer libavutil/softfloat: Add test case for av_add_sf Recently normalization (av_normalize_sf) of output was added to av_add_sf. This normalization is used for better precision for small values and the purpose of this (quite simple) test case is to test difference between double and softfloat. The values used are tailored to maximally highlighte problem with precison when normalization is not used. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=729466dc68f9166c13be79581ecc8a79411ee885 --- libavutil/softfloat.c | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/libavutil/softfloat.c b/libavutil/softfloat.c index bf9cfda..b6e1f35 100644 --- a/libavutil/softfloat.c +++ b/libavutil/softfloat.c @@ -26,10 +26,21 @@ #undef printf +static const SoftFloat FLOAT_0_017776489257 = {0x1234, 12}; +static const SoftFloat FLOAT_1374_40625 = {0xabcd, 25}; +static const SoftFloat FLOAT_0_1249694824218 = {0xFFF, 15}; + + +static av_const double av_sf2double(SoftFloat v) { +v.exp -= ONE_BITS +1; +if(v.exp > 0) return (double)v.mant * (double)(1 << v.exp); +else return (double)v.mant / (double)(1 << (-v.exp)); +} + int main(void){ SoftFloat one= av_int2sf(1, 0); -SoftFloat sf1, sf2; -double d1, d2; +SoftFloat sf1, sf2, sf3; +double d1, d2, d3; int i, j; av_log_set_level(AV_LOG_DEBUG); @@ -67,5 +78,21 @@ int main(void){ STOP_TIMER("softfloat add mul") } printf("test2 sf=%d (%d %d)\n", av_sf2int(sf1, 24), sf1.exp, sf1.mant); + +d1 = 0.0177764893; +d2 = 1374.40625; +d3 = 0.1249694824; +d2 += d1; +d3 += d2; +printf("test3 double: %.10lf\n", d3); + +sf1 = FLOAT_0_017776489257; +sf2 = FLOAT_1374_40625; +sf3 = FLOAT_0_1249694824218; +sf2 = av_add_sf(sf1, sf2); +sf3 = av_add_sf(sf3, sf2); +printf("test3 softfloat: %.10lf (0x%08x %d)\n", (double)av_sf2double(sf3), sf3.mant, sf3.exp); + return 0; + } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavutil/softfloat: Add functions.
ffmpeg | branch: master | Nedeljko Babic | Thu Apr 30 13:51:37 2015 +0200| [1fae26830797ac8e04afb0866aa6f3805e8e98e4] | committer: Michael Niedermayer libavutil/softfloat: Add functions. Functions av_gt_sf, av_sqrt_sf and av_sincos_sf added to softfloat Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1fae26830797ac8e04afb0866aa6f3805e8e98e4 --- libavutil/softfloat.h| 93 ++- libavutil/softfloat_tables.h | 260 ++ 2 files changed, 352 insertions(+), 1 deletion(-) diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h index 42b3c3e..d6cfc3c 100644 --- a/libavutil/softfloat.h +++ b/libavutil/softfloat.h @@ -25,6 +25,7 @@ #include "common.h" #include "avassert.h" +#include "softfloat_tables.h" #define MIN_EXP -126 #define MAX_EXP 126 @@ -102,6 +103,13 @@ static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){ elsereturn a.mant - (b.mant >> t); } +static inline av_const int av_gt_sf(SoftFloat a, SoftFloat b) +{ +int t= a.exp - b.exp; +if(t<0) return (a.mant >> (-t)) > b.mant ; +elsereturn a.mant > (b.mant >> t); +} + static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){ int t= a.exp - b.exp; if (t <-31) return b; @@ -114,7 +122,7 @@ static inline av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b){ return av_add_sf(a, (SoftFloat){ -b.mant, b.exp}); } -//FIXME sqrt, log, exp, pow, sin, cos +//FIXME log, exp, pow /** * Converts a mantisse and exponent to a SoftFloat @@ -133,4 +141,87 @@ static inline av_const int av_sf2int(SoftFloat v, int frac_bits){ else return v.mant >>(-v.exp); } +/** + * Rounding-to-nearest used. + */ +static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val) +{ +int tabIndex, rem; + +if (val.mant == 0) +val.exp = 0; +else +{ +tabIndex = (val.mant - 0x2000) >> 20; + +rem = val.mant & 0xF; +val.mant = (int)(((int64_t)av_sqrttbl_sf[tabIndex] * (0x10 - rem) + + (int64_t)av_sqrttbl_sf[tabIndex + 1] * rem + + 0x8) >> 20); +val.mant = (int)(((int64_t)av_sqr_exp_multbl_sf[val.exp & 1] * val.mant + + 0x1000) >> 29); + +if (val.mant < 0x4000) +val.exp -= 2; +else +val.mant >>= 1; + +val.exp = (val.exp >> 1) + 1; +} + +return val; +} + +/** + * Rounding-to-nearest used. + */ +static av_always_inline void av_sincos_sf(int a, int *s, int *c) +{ +int idx, sign; +int sv, cv; +int st, ct; + +idx = a >> 26; +sign = (idx << 27) >> 31; +cv = av_costbl_1_sf[idx & 0xf]; +cv = (cv ^ sign) - sign; + +idx -= 8; +sign = (idx << 27) >> 31; +sv = av_costbl_1_sf[idx & 0xf]; +sv = (sv ^ sign) - sign; + +idx = a >> 21; +ct = av_costbl_2_sf[idx & 0x1f]; +st = av_sintbl_2_sf[idx & 0x1f]; + +idx = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x2000) >> 30); + +sv = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x2000) >> 30); + +cv = idx; + +idx = a >> 16; +ct = av_costbl_3_sf[idx & 0x1f]; +st = av_sintbl_3_sf[idx & 0x1f]; + +idx = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x2000) >> 30); + +sv = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x2000) >> 30); +cv = idx; + +idx = a >> 11; + +ct = (int)(((int64_t)av_costbl_4_sf[idx & 0x1f] * (0x800 - (a & 0x7ff)) + +(int64_t)av_costbl_4_sf[(idx & 0x1f)+1]*(a & 0x7ff) + +0x400) >> 11); +st = (int)(((int64_t)av_sintbl_4_sf[idx & 0x1f] * (0x800 - (a & 0x7ff)) + +(int64_t)av_sintbl_4_sf[(idx & 0x1f) + 1] * (a & 0x7ff) + +0x400) >> 11); + +*c = (int)(((int64_t)cv * ct + (int64_t)sv * st + 0x2000) >> 30); + +*s = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x2000) >> 30); +} + #endif /* AVUTIL_SOFTFLOAT_H */ diff --git a/libavutil/softfloat_tables.h b/libavutil/softfloat_tables.h new file mode 100644 index 000..9d3c808 --- /dev/null +++ b/libavutil/softfloat_tables.h @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2012 + * MIPS Technologies, Inc., California. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyri
[FFmpeg-cvslog] libavutil/softfloat: Added av_normalize_sf in av_add_sf
ffmpeg | branch: master | Nedeljko Babic | Thu Apr 30 13:51:36 2015 +0200| [7bab2814753326f74b0f0f158efb250b7f80442c] | committer: Michael Niedermayer libavutil/softfloat: Added av_normalize_sf in av_add_sf This will normalize sums for which mantissa is smaller than the lower boundary (needed for implementation of fixed point aac decoder). Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7bab2814753326f74b0f0f158efb250b7f80442c --- libavutil/softfloat.h |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h index 5f4ac26..42b3c3e 100644 --- a/libavutil/softfloat.h +++ b/libavutil/softfloat.h @@ -105,8 +105,8 @@ static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){ static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){ int t= a.exp - b.exp; if (t <-31) return b; -else if (t < 0) return av_normalize1_sf((SoftFloat){b.mant + (a.mant >> (-t)), b.exp}); -else if (t < 32) return av_normalize1_sf((SoftFloat){a.mant + (b.mant >> t ), a.exp}); +else if (t < 0) return av_normalize_sf(av_normalize1_sf((SoftFloat){ b.mant + (a.mant >> (-t)), b.exp})); +else if (t < 32) return av_normalize_sf(av_normalize1_sf((SoftFloat){ a.mant + (b.mant >> t ), a.exp})); else return a; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavutil/softfloat: exponent adjusted for aac fixed point dec
ffmpeg | branch: master | Nedeljko Babic | Thu Apr 30 13:51:35 2015 +0200| [a1c7fe431c5077e8bcf78d696c01ef653c34db2c] | committer: Michael Niedermayer libavutil/softfloat: exponent adjusted for aac fixed point dec Exponent usage and calculation in softfloat adjusted to the format used in implementation of fixed point aac decoder. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1c7fe431c5077e8bcf78d696c01ef653c34db2c --- libavutil/softfloat.h |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h index 2e85765..5f4ac26 100644 --- a/libavutil/softfloat.h +++ b/libavutil/softfloat.h @@ -83,7 +83,7 @@ static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){ a.exp += b.exp; av_assert2((int32_t)((a.mant * (int64_t)b.mant) >> ONE_BITS) == (a.mant * (int64_t)b.mant) >> ONE_BITS); a.mant = (a.mant * (int64_t)b.mant) >> ONE_BITS; -return av_normalize1_sf(a); +return av_normalize1_sf((SoftFloat){a.mant, a.exp - 1}); } /** @@ -91,7 +91,7 @@ static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){ * @return Will not be more denormalized than a. */ static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){ -a.exp -= b.exp+1; +a.exp -= b.exp; a.mant = ((int64_t)a.mant<<(ONE_BITS+1)) / b.mant; return av_normalize1_sf(a); } @@ -121,14 +121,14 @@ static inline av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b){ * @returns a SoftFloat with value v * 2^frac_bits */ static inline av_const SoftFloat av_int2sf(int v, int frac_bits){ -return av_normalize_sf((SoftFloat){v, ONE_BITS-frac_bits}); +return av_normalize_sf((SoftFloat){v, ONE_BITS + 1 - frac_bits}); } /** * Rounding is to -inf. */ static inline av_const int av_sf2int(SoftFloat v, int frac_bits){ -v.exp += frac_bits - ONE_BITS; +v.exp += frac_bits - (ONE_BITS + 1); if(v.exp >= 0) return v.mant << v.exp ; else return v.mant >>(-v.exp); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavutil/softfloat: Change order of fields in SoftFloat structure.
ffmpeg | branch: master | Nedeljko Babic | Wed Apr 15 15:14:06 2015 +0200| [f4ccf3890285f2c5a055f0cc92405a0f46cdfab2] | committer: Michael Niedermayer libavutil/softfloat: Change order of fields in SoftFloat structure. Softfloat will be used in implementation of AAC fixed point decoder. This change is needed in order to more easily integrate ffmpegs softfloat in already developed algorithm for AAC. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f4ccf3890285f2c5a055f0cc92405a0f46cdfab2 --- libavutil/softfloat.h | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h index 8647e6a..654a31f 100644 --- a/libavutil/softfloat.h +++ b/libavutil/softfloat.h @@ -31,8 +31,8 @@ #define ONE_BITS 29 typedef struct SoftFloat{ -int32_t exp; int32_t mant; +int32_t exp; }SoftFloat; static av_const SoftFloat av_normalize_sf(SoftFloat a){ @@ -67,10 +67,10 @@ static inline av_const SoftFloat av_normalize1_sf(SoftFloat a){ return a; #elif 1 int t= a.mant + 0x4000 < 0; -return (SoftFloat){a.exp+t, a.mant>>t}; +return (SoftFloat){ a.mant>>t, a.exp+t}; #else int t= (a.mant + 0x4000U)>>31; -return (SoftFloat){a.exp+t, a.mant>>t}; +return (SoftFloat){a.mant>>t, a.exp+t}; #endif } @@ -105,19 +105,19 @@ static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){ static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){ int t= a.exp - b.exp; if (t <-31) return b; -else if (t < 0) return av_normalize1_sf((SoftFloat){b.exp, b.mant + (a.mant >> (-t))}); -else if (t < 32) return av_normalize1_sf((SoftFloat){a.exp, a.mant + (b.mant >> t )}); +else if (t < 0) return av_normalize1_sf((SoftFloat){b.mant + (a.mant >> (-t)), b.exp}); +else if (t < 32) return av_normalize1_sf((SoftFloat){a.mant + (b.mant >> t ), a.exp}); else return a; } static inline av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b){ -return av_add_sf(a, (SoftFloat){b.exp, -b.mant}); +return av_add_sf(a, (SoftFloat){ -b.mant, b.exp}); } //FIXME sqrt, log, exp, pow, sin, cos static inline av_const SoftFloat av_int2sf(int v, int frac_bits){ -return av_normalize_sf((SoftFloat){ONE_BITS-frac_bits, v}); +return av_normalize_sf((SoftFloat){v, ONE_BITS-frac_bits}); } /** ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mips/float_dsp: fix a bug in vector_fmul_window_mips
ffmpeg | branch: master | Nedeljko Babic | Thu Mar 5 12:23:59 2015 +0100| [dfa920807494f0bc505aa090e036b531daa604ad] | committer: Michael Niedermayer mips/float_dsp: fix a bug in vector_fmul_window_mips Loop was unrolled eight times although in heder there is assumption that len is multiple of 4. This is fixed, and assembly code is rewritten to be more optimal and to simplify clobber list. Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dfa920807494f0bc505aa090e036b531daa604ad --- libavutil/mips/float_dsp_mips.c | 180 --- 1 file changed, 74 insertions(+), 106 deletions(-) diff --git a/libavutil/mips/float_dsp_mips.c b/libavutil/mips/float_dsp_mips.c index 06d52dc..a54f959 100644 --- a/libavutil/mips/float_dsp_mips.c +++ b/libavutil/mips/float_dsp_mips.c @@ -144,114 +144,82 @@ static void vector_fmul_scalar_mips(float *dst, const float *src, float mul, } static void vector_fmul_window_mips(float *dst, const float *src0, -const float *src1, const float *win, int len) +const float *src1, const float *win, int len) { -int i, j; -/* - * variables used in inline assembler - */ -float * dst_i, * dst_j, * dst_i2, * dst_j2; -float temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7; +float * dst_j, *win_j, *src0_i, *src1_j, *dst_i, *win_i; +float temp, temp1, temp2, temp3; +float s0, s01, s1, s11; +float wi, wi1, wi2, wi3; +float wj, wj1, wj2, wj3; +const float * lp_end = win + len; + +win_i = (float *)win; +win_j = (float *)(win + 2 * len -1); +src1_j = (float *)(src1 + len - 1); +src0_i = (float *)src0; +dst_i = (float *)dst; +dst_j = (float *)(dst + 2 * len -1); -dst += len; -win += len; -src0 += len; - -for (i = -len, j = len - 1; i < 0; i += 8, j -= 8) { - -dst_i = dst + i; -dst_j = dst + j; - -dst_i2 = dst + i + 4; -dst_j2 = dst + j - 4; - -__asm__ volatile ( -"mul.s %[temp], %[s1], %[wi]\n\t" -"mul.s %[temp1], %[s1], %[wj]\n\t" -"mul.s %[temp2], %[s11], %[wi1] \n\t" -"mul.s %[temp3], %[s11], %[wj1] \n\t" - -"msub.s %[temp], %[temp], %[s0], %[wj]\n\t" -"madd.s %[temp1], %[temp1],%[s0], %[wi]\n\t" -"msub.s %[temp2], %[temp2],%[s01], %[wj1] \n\t" -"madd.s %[temp3], %[temp3],%[s01], %[wi1] \n\t" - -"swc1%[temp], 0(%[dst_i]) \n\t" /* dst[i] = s0*wj - s1*wi; */ -"swc1%[temp1], 0(%[dst_j]) \n\t" /* dst[j] = s0*wi + s1*wj; */ -"swc1%[temp2], 4(%[dst_i]) \n\t" /* dst[i+1] = s01*wj1 - s11*wi1; */ -"swc1%[temp3], -4(%[dst_j]) \n\t" /* dst[j-1] = s01*wi1 + s11*wj1; */ - -"mul.s %[temp4], %[s12], %[wi2] \n\t" -"mul.s %[temp5], %[s12], %[wj2] \n\t" -"mul.s %[temp6], %[s13], %[wi3] \n\t" -"mul.s %[temp7], %[s13], %[wj3] \n\t" - -"msub.s %[temp4], %[temp4],%[s02], %[wj2] \n\t" -"madd.s %[temp5], %[temp5],%[s02], %[wi2] \n\t" -"msub.s %[temp6], %[temp6],%[s03], %[wj3] \n\t" -"madd.s %[temp7], %[temp7],%[s03], %[wi3] \n\t" - -"swc1%[temp4], 8(%[dst_i]) \n\t" /* dst[i+2] = s02*wj2 - s12*wi2; */ -"swc1%[temp5], -8(%[dst_j]) \n\t" /* dst[j-2] = s02*wi2 + s12*wj2; */ -"swc1%[temp6], 12(%[dst_i]) \n\t" /* dst[i+2] = s03*wj3 - s13*wi3; */ -"swc1%[temp7], -12(%[dst_j]) \n\t" /* dst[j-3] = s03*wi3 + s13*wj3; */ -: [temp]"=&f"(temp), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), - [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5), - [temp6]"=&f"(temp6), [temp7]"=&f"(temp7) -: [dst_j]"r"(dst_j), [dst_i]"r" (dst_i), - [s0] "f"(src0[i]), [wj] "f"(win[j]), [s1] "f"(src1[j]), - [wi] "f"(win[i]), [s01]"f"(src0[i + 1]),[wj1]"f"(win[j - 1]), - [s11]"f"(src1[j - 1]), [wi1]"f"(win