Just to explain a little more, scfi is a flag that tells the encoder
that some of the scalefactors for both granules (gr=0 & gr=1) are the
same.  So it saves the encoding of some scalefactors for gr=1, at the
expense of requiring them to be the same.  I dont think it is a good
idea to use scfsi for two reasons:

1) the usual excuse:  FhG doesnt use it :-)

2) scfsi was dropped in MPEG2.  MPEG2 is just like MPEG1 except
they only encode 1 granule per frame, and thus no scfsi.  If 
scfsi had turned out to be usefull in practice, I think they would
have kept it in MPEG2.

3) However, Xing does use scfsi.

To answer Q1 and Q2: I dont know!  It should be in the dist10 encoder
source, but I wouldn't trust it to be correct.  The dist10 source was
buggy and would never turn scsfi on, so the code was probably never
tested.  Better to take a look at the mpglib decoder source in
lame/mpglib/layer3.c and see what they do.

Q3 is a good point, and I think your second thought is correct: it is
only a recommendation.  Pre-emphasis is just a flag to save bits when
encoding the scalefactors.  Since most frames have non-zero
scalefactors in the last few scalefactor bands, pre-emph can be used
to reduce their values.  (and save space?)  The best thing to do would
be to determine all the scalefactors without using pre-emph, and then
look and see if we can save bits by using pre-emph instead.  It is
complicated by the fact that the valid range of scalefactors is a
little larger if you are going to use scfsi. 

You also bring up a good point that hadn't occured to me before: The
algorithm now turns on pre-emph only if the last 4 scalefactors need
amplification (sfb=18->21).  But this also boosts the scalefactors for
sfb=12->17, resulting in poor bit allocation if these sfb's do not
need any amplification.

Mark







Takehiro TOMINAGA wrote:

> Hi all!
> 
> I have some question about "scfsi".
> 
> I made an additional routine called after final iteration of 
> iteration_loop, in quantize.c.
> 
> This routine calculate how many bits are demanded to store the
> scalefactor. And as it uses the scfsi, scalefac_scale, and
> preflag(preemphasis), the efficiency of bit allocation will be
> improved. See my latest snapshot 1115 or 1115-2, like
> http://www.isoternet.org/~tominaga/lame-beta/lame-1115-2.tar.bz2.
> 
> I will merge this code into current LAME, but before the merging, I
> wanna the answer of the below questions....
> 
> Q1 Is this allowed that set the preflag of gr=0 different from that of
>    gr=1, and use the scfsi on the scalefactor band that preemphasis is
>    effected on.
> 
>    And if it is allowed, how to scalefactor determin ?
> 
> example) preflag[gr = 0] = 1, preflag[gr = 1] = 0,
>         scfsi = 0001 <- does the MP3 standard allow this stuation ?
>     and
>         scalefactor[gr = 0] = stored (..... 1) + pretab effect (..... 2) = 3
>     then
>         scalefactor[gr = 1] = 1 or 3 <- which one is used ?
> 
> Q2 Same as Q1 for not preflag but scalefac_scale.
> 
> Q3 in the dist10 code, preemphasis(preflag) is used when the all of
>    upper 4 scalefactor bands are distorted. but when enabling preflag,
>    it amplify the upper 10 bands. I think it is wasting the bits...
> 
>    there is a comment in the dist 10 code before the enabling preflag,
>    saying "see if we should use the preemphasis".
> 
>    Does the MP3 standard says that we *must* enable the preemphasis
>    when the all of upper 4 scalefactor bands are distorted ? Or is it
>    only the recomendation ?
> 
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to