[FFmpeg-devel] [PATCH] Bink file demuxer and audio decoder
pross at xvid.org
pross
Wed Jan 20 11:15:24 CET 2010
On Thu, Jun 25, 2009 at 12:11:54AM +0200, Diego Biurrun wrote:
> On Sat, Jun 20, 2009 at 11:49:05PM +1000, Peter Ross wrote:
> >
> > --- libavcodec/Makefile (revision 19182)
> > +++ libavcodec/Makefile (working copy)
> > @@ -27,6 +27,7 @@
> > # parts needed for many different codecs
> > OBJS-$(CONFIG_AANDCT) += aandcttab.o
> > OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
> > +OBJS-$(CONFIG_DCT) += dct.o
> > OBJS-$(CONFIG_FFT) += fft.o
> > OBJS-$(CONFIG_GOLOMB) += golomb.o
> > OBJS-$(CONFIG_MDCT) += mdct.o
>
> Ahem...
>
> > --- libavcodec/dct.c (revision 0)
> > +++ libavcodec/dct.c (revision 0)
> > @@ -0,0 +1,95 @@
> > +
> > +static void ff_dct_calc_c(DCTContext *s, FFTSample *data)
>
> There is no need to give static functions ff_ prefixes.
>
> > + for(i=0; i < n; i++) {
>
> consistent application of K&R please..
>
> > + for(i=0; i<n-1; i++) {
>
> ditto
>
> > + }else{
>
> ditto
>
> > + for(i=0; i < n; i++) {
>
> ditto
>
> > + if (s->inverse) {
> > + for(i=0; i < n; i++)
>
> ditto
>
> > + data[i] = s->data[n-(i+1)].re / (2 * n);
> > + }else {
>
> ditto
>
> > + for(i=0; i < n; i++)
>
> ditto
>
> > --- libavcodec/binkaudio.c (revision 0)
> > +++ libavcodec/binkaudio.c (revision 0)
> > @@ -0,0 +1,307 @@
> > +static void decode_block(BinkAudioContext *s, short *out)
> > +{
> > + int ch, i, j, k;
> > + float q, quant[25];
> > + int width, coeff;
> > + GetBitContext *gb = &s->gb;
> > +
> > + if (s->use_dct) {
> > + skip_bits(gb, 2);
> > + }
>
> useless {}
>
> > + // find band (k)
> > + for (k = 0; s->bands[k] * 2 < 2; k++) {
> > + q = quant[k];
> > + }
>
> ditto
>
> > +AVCodec binkaudio1_decoder = {
> > + "binkaudio1",
> > + CODEC_TYPE_AUDIO,
> > + CODEC_ID_BINKAUDIO1,
> > + sizeof(BinkAudioContext),
> > + decode_init,
> > + NULL,
> > + decode_end,
> > + decode_frame
> > +};
> > +
> > +AVCodec binkaudio2_decoder = {
> > + "binkaudio2",
> > + CODEC_TYPE_AUDIO,
> > + CODEC_ID_BINKAUDIO2,
> > + sizeof(BinkAudioContext),
> > + decode_init,
> > + NULL,
> > + decode_end,
> > + decode_frame
> > +};
>
> Long names are missing.
>
> > --- doc/general.texi (revision 19236)
> > +++ doc/general.texi (working copy)
> > @@ -544,6 +544,8 @@
> > @item Apple lossless audio @tab X @tab X
> > @tab QuickTime fourcc 'alac'
> > @item Atrac 3 @tab @tab X
> > + at item Bink Audio @tab @tab X
> > + @tab Used in Bink and Smacker files in many games.
>
> Is it worth mentioning that both types are supported? I guess only if
> other types remain..
>
> > --- libavformat/bink.c (revision 0)
> > +++ libavformat/bink.c (revision 0)
> > @@ -0,0 +1,245 @@
> > + if (b[0] == 'B' && b[1] == 'I' && b[2] == 'K' &&
> > + (b[3] == 'b' || b[3] == 'f' || b[3] == 'g' || b[3] == 'h' || b[3] == 'i') &&
> > + AV_RL32(b+8) > 0 && // num_frames
> > + AV_RL32(b+20) > 0 && AV_RL32(b+20) <= BINK_MAX_WIDTH &&
> > + AV_RL32(b+24) > 0 && AV_RL32(b+24) <= BINK_MAX_HEIGHT &&
> > + AV_RL32(b+28) > 0 && AV_RL32(b+32) > 0) // fps num,den
>
> This could be more readable nicely aligned.
>
> > +AVInputFormat bink_demuxer = {
> > + "bink",
> > + "Bink",
> > + sizeof(BinkDemuxContext),
> > + probe,
> > + read_header,
> > + read_packet,
> > +};
>
> Long name is missing.
Fixes incorporated. Revised patchset enclosed.
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smacker-decoder-r300.diff
Type: text/x-diff
Size: 1565 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100120/8f59209a/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: export-wma-critial-freqs.diff
Type: text/x-diff
Size: 1428 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100120/8f59209a/attachment-0001.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bink-demuxer-r4b.diff
Type: text/x-diff
Size: 9922 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100120/8f59209a/attachment-0002.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binkaudio-decoder-r4b.diff
Type: text/x-diff
Size: 12101 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100120/8f59209a/attachment-0003.diff>
-------------- 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/20100120/8f59209a/attachment.pgp>
More information about the ffmpeg-devel
mailing list