[Ffmpeg-devel] [PATCH] flv adpcm encoder

Michael Niedermayer michaelni
Tue Mar 6 02:02:22 CET 2007


Hi


On Mon, Mar 05, 2007 at 08:04:40AM +0100, Benjamin Larsson wrote:
> Jeff Clagg wrote:
> > On Sun, Mar 04, 2007 at 10:51:50PM +0100, Benjamin Larsson wrote:
> >> Hi, this is an almost working by the specs adpcm encoder for flv and swf
> >> files. I think the reason it isn't work so well is because of the muxing
> >> and not the encoding. If the muxing isn't fixed there is not much reason
> >> for this patch to be applied.
> > 
> > I'm very impressed by how small and elegant the code is.
> 
> Thanks.
> 
> Anyway, here is an updated less elegant version.

[...]
> @@ -180,6 +180,9 @@
>          avctx->frame_size = BLKSIZE * avctx->channels;
>          avctx->block_align = BLKSIZE;
>          break;
> +    case CODEC_ID_ADPCM_SWF:
> +        avctx->frame_size = 4*BLKSIZE * avctx->channels;
> +        break;

shouldnt block_align be initalized here too?

[...]
> +
> +        //Store AdpcmCodeSize
> +        put_bits(&pb, 2, 2);                //Set 4bits flash adpcm format
> +        put_bits(&pb, 16, samples[0] & 0xFFFF);
> +        put_bits(&pb, 6, c->status[0].step_index & 0x3F);
> +
> +        //Init the encoder state
> +        c->status[0].prev_sample = (signed short)samples[0];
> +
> +        if (avctx->channels == 2) {
> +            //Store right channel
> +            put_bits(&pb, 16, samples[1] & 0xFFFF);
> +            put_bits(&pb, 6, c->status[1].step_index & 0x3F);
> +            c->status[1].prev_sample = (signed short)samples[1];
> +        }

for(i=0; i<avctx->channels; i++){
    put_bits(&pb, 16, samples[i] & 0xFFFF);
    put_bits(&pb, 6, c->status[i].step_index & 0x3F);
    c->status[i].prev_sample = (signed short)samples[i];
}


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070306/0831d764/attachment.pgp>



More information about the ffmpeg-devel mailing list