[FFmpeg-devel] Trans.: a64multienc.c and drawutils.c optimisations
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Wed Dec 28 11:58:30 CET 2011
On Wed, Dec 28, 2011 at 06:14:02AM +0100, yann.lepetitcorps at free.fr wrote:
> > > +int adpcm_nibble_diff_step_tab[8] = { 0, 4, 2, 6, 1, 3, 5, 7 };
> > > +
> > > static inline int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int
> > nibble, int shift)
> > > {
> > > int step_index;
> > > @@ -169,11 +171,13 @@ static inline int
> > adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble,
> > > step = ff_adpcm_step_table[c->step_index];
> > > step_index = c->step_index + ff_adpcm_index_table[nibble];
> > > step_index = av_clip(step_index, 0, 88);
> > > -
> > > +/*
> > > diff = step >> 3;
> > > if (nibble & 4) diff += step;
> > > if (nibble & 2) diff += step >> 1;
> > > if (nibble & 1) diff += step >> 2;
> > > +*/
> > > + diff = (adpcm_nibble_diff_step_tab[nibble &0x7]+8) * step;
> >
> > see adpcm_ima_expand_nibble()
> > one problem though is that this is not producing the same result
>
> I have tested nothing :(
>
> I think that the adpcm_nibble_diff_step_tab[] and/or the diff computation aren't
> corrects (but the idea is here)
>
> What is the good way for to test "randomly" modifications ?
You can test that code exhaustively, just something along these lines:
int main(void) {
for (stepidx = 0; stepidx <= 88; stepidx++)
for (nibble = 0; nibble < 7; nibble++)
{
step = ff_adpcm_step_table[stepid];
int diffb;
int diff = step >> 3;
if (nibble & 4) diff += step;
if (nibble & 2) diff += step >> 1;
if (nibble & 1) diff += step >> 2;
diffb = (adpcm_nibble_diff_step_tab[nibble &0x7]+8) * step;
if (diff != diffb) {
printf("new code differs at: %i %i, %i vs. %i", stepidx, nibble, diff, diffb);
return 1;
}
}
return 0;
}
> > also it is best to send each self contained change in a seperate patch,
> > like 1 patch for the adpcm change and one patch for the drawutils.
>
> What is the needed command for to have the 'git diff' but only for somes files ?
git diff filea.c
Same as for svn really if you are familiar with that...
More information about the ffmpeg-devel
mailing list