[FFmpeg-devel] [PATCH] libspeex Speex encoding

Michael Niedermayer michaelni
Fri Oct 30 00:25:54 CET 2009


On Thu, Oct 29, 2009 at 06:16:31PM -0400, Justin Ruggles wrote:
> Michael Niedermayer wrote:
> 
> > On Wed, Oct 28, 2009 at 07:45:45PM -0400, Justin Ruggles wrote:
> >> Michael Niedermayer wrote:
> >>
> >>> On Tue, Oct 27, 2009 at 05:54:51PM -0400, Justin Ruggles wrote:
> >>>> Michael Niedermayer wrote:
> >>>>
> >>>>> On Sun, Oct 25, 2009 at 09:04:45AM -0400, Justin Ruggles wrote:
> >>>>>> +            new_samples_size  = avctx->frame_size * avctx->channels *
> >>>>>> +                                (avctx->sample_fmt == SAMPLE_FMT_FLT ?
> >>>>>> +                                sizeof(float) : sizeof(int16_t));
> >>>>>> +            samples = av_mallocz(new_samples_size);
> >>>>>> +            if (!samples)
> >>>>>> +                return AVERROR(ENOMEM);
> >>>>>> +            memcpy(samples, data, new_samples_size);
> >>>>> i think the application is or at least should be required to allocate full
> >>>>> frames even for the possibly smaller last
> >>>> Where should this be documented?  avcodec_encode_audio()?
> >>> yes and close to CODEC_CAP_SMALL_LAST_FRAME
> >> Should the API require that the rest of the frame be padded with zeros?
> >>  The encoder cannot modify the data, so if this is not required, the
> >> data would have to be copied in the encoder where there remaining
> >> samples could be zeroed out... thus making the allocation requirement
> >> useless.
> > 
> > This actually brings up another issue ...
> > is zero padding even required / a good idea?
> > If these samples are never output then other forms of padding
> > might lead to higher quality & lower bitrate of the last frame.
> > The simplest thing to try would be simple reflecting the values
> > that is:
> > instead of ABCDEF000000
> > ABCDEFEDCBA or ABCDEFFEDCBA
> 
> For 20ms at the end of a stream does it really matter?  For Speex

well, probably not, unless you have many short files ...
it was just an idea, as we dont zero pad video either and that helps
quality/bitrate of the borders ...


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091030/5ed302b5/attachment.pgp>



More information about the ffmpeg-devel mailing list