[FFmpeg-soc] [soc]: r3305 - in aacenc: aacenc.c aacpsy.c aacpsy.h
kostya
subversion at mplayerhq.hu
Fri Aug 15 09:04:51 CEST 2008
Author: kostya
Date: Fri Aug 15 09:04:50 2008
New Revision: 3305
Log:
Pulse detection is inefficient and should belong to encoder, so remove it from psy model code
Modified:
aacenc/aacenc.c
aacenc/aacpsy.c
aacenc/aacpsy.h
Modified: aacenc/aacenc.c
==============================================================================
--- aacenc/aacenc.c (original)
+++ aacenc/aacenc.c Fri Aug 15 09:04:50 2008
@@ -27,7 +27,7 @@
/***********************************
* TODOs:
* psy model selection with some option
- * change greedy codebook search into something more optimal, like Viterbi algorithm
+ * change greedy codebook search into something more optimal, like Viterbi algorithm, add sane pulse detection
* determine run lengths along with codebook
***********************************/
Modified: aacenc/aacpsy.c
==============================================================================
--- aacenc/aacpsy.c (original)
+++ aacenc/aacpsy.c Fri Aug 15 09:04:50 2008
@@ -79,7 +79,7 @@ static inline float calc_distortion(floa
/**
* Produce integer coefficients from scalefactors provided by the model.
*/
-static void psy_create_output(AACPsyContext *apc, ChannelElement *cpe, int chans, int search_pulses)
+static void psy_create_output(AACPsyContext *apc, ChannelElement *cpe, int chans)
{
int i, w, w2, wg, g, ch;
int start, sum, maxsfb, cmaxsfb;
@@ -104,33 +104,6 @@ static void psy_create_output(AACPsyCont
else
memset(cpe->ch[ch].icoefs + start, 0, cpe->ch[ch].ics.swb_sizes[g] * sizeof(cpe->ch[0].icoefs[0]));
cpe->ch[ch].zeroes[w][g] = !sum;
- //try finding pulses
- if(search_pulses && cpe->ch[ch].ics.num_windows == 1 && !cpe->ch[ch].pulse.num_pulse){
- pulses = 0;
- memset(poff,0,sizeof(poff));
- memset(pamp,0,sizeof(pamp));
- for(i = 0; i < cpe->ch[ch].ics.swb_sizes[g]; i++){
- if(pulses > 4 || (pulses && i > cpe->ch[ch].pulse.offset[pulses-1] - 31)) break;
- if(FFABS(cpe->ch[ch].icoefs[start+i]) > 4 && pulses < 4){
- poff[pulses] = i;
- pamp[pulses] = FFMIN(FFABS(cpe->ch[ch].icoefs[start+i]) - 1, 15);
- pulses++;
- }
- }
- if(pulses){
- cpe->ch[ch].pulse.start = g;
- cpe->ch[ch].pulse.num_pulse = pulses;
- for(i = 0; i < pulses; i++){
- cpe->ch[ch].pulse.amp[i] = pamp[i];
- cpe->ch[ch].pulse.offset[i] = i ? poff[i] - poff[i-1] : poff[0];
-
- if(cpe->ch[ch].icoefs[start+poff[i]] > 0)
- cpe->ch[ch].icoefs[start+poff[i]] -= pamp[i];
- else
- cpe->ch[ch].icoefs[start+poff[i]] += pamp[i];
- }
- }
- }
start += cpe->ch[ch].ics.swb_sizes[g];
}
for(cmaxsfb = cpe->ch[ch].ics.num_swb; cmaxsfb > 0 && cpe->ch[ch].zeroes[w][cmaxsfb-1]; cmaxsfb--);
@@ -222,7 +195,7 @@ static void psy_null_process(AACPsyConte
if(!cpe->ch[ch].zeroes[0][g])
cpe->ch[ch].sf_idx[0][g] = FFMIN(minscale + SCALE_MAX_DIFF, cpe->ch[ch].sf_idx[0][g]);
}
- psy_create_output(apc, cpe, chans, 1);
+ psy_create_output(apc, cpe, chans);
}
static void psy_null8_window(AACPsyContext *apc, int16_t *audio, int16_t *la, int tag, int type, ChannelElement *cpe)
@@ -288,7 +261,7 @@ static void psy_null8_process(AACPsyCont
}
}
}
- psy_create_output(apc, cpe, chans, 0);
+ psy_create_output(apc, cpe, chans);
}
/**
@@ -837,7 +810,7 @@ static void psy_3gpp_process(AACPsyConte
}
memcpy(pch->prev_band, pch->band, sizeof(pch->band));
- psy_create_output(apc, cpe, chans, !(apc->flags & PSY_MODEL_NO_PULSE));
+ psy_create_output(apc, cpe, chans);
}
static av_cold void psy_3gpp_end(AACPsyContext *apc)
Modified: aacenc/aacpsy.h
==============================================================================
--- aacenc/aacpsy.h (original)
+++ aacenc/aacpsy.h Fri Aug 15 09:04:50 2008
@@ -41,7 +41,6 @@ enum AACPsyModelMode{
};
#define PSY_MODEL_MODE_MASK 0x0000000F ///< bit fields for storing mode (CBR, ABR, VBR)
-#define PSY_MODEL_NO_PULSE 0x00000010 ///< disable pulse searching
#define PSY_MODEL_NO_SWITCH 0x00000020 ///< disable window switching
#define PSY_MODEL_NO_ST_ATT 0x00000040 ///< disable stereo attenuation
#define PSY_MODEL_NO_LOWPASS 0x00000080 ///< disable low-pass filtering
More information about the FFmpeg-soc
mailing list