[FFmpeg-devel] [PATCH] Xxan decoder
Michael Niedermayer
michaelni
Sat Dec 19 15:37:52 CET 2009
On Sat, Dec 19, 2009 at 01:38:02PM +0200, Kostya wrote:
> Now as clean patch (without docs or field clarification).
> I also recommend leaving it for some student to finish.
hmm
id guess a student needs months for this if he works hard
you could clean it up into commitable shape in a few hours
[...]
> @@ -72,13 +74,15 @@
> return -1;
> }
>
> - avctx->pix_fmt = PIX_FMT_PAL8;
> + avctx->pix_fmt = (avctx->codec->id == CODEC_ID_XAN_WC3) ? PIX_FMT_PAL8 : PIX_FMT_YUV420P;
>
> s->buffer1_size = avctx->width * avctx->height;
> s->buffer1 = av_malloc(s->buffer1_size);
> s->buffer2_size = avctx->width * avctx->height;
> s->buffer2 = av_malloc(s->buffer2_size + 130);
> - if (!s->buffer1 || !s->buffer2)
> + s->buffer3_size = avctx->width * avctx->height;
> + s->buffer3 = av_malloc(s->buffer2_size + 130);
> + if (!s->buffer1 || !s->buffer2 || !s->buffer3)
> return -1;
>
> return 0;
is there code that frees these buffers if one fails?
[...]
> @@ -359,19 +592,22 @@
> XanContext *s = avctx->priv_data;
> AVPaletteControl *palette_control = avctx->palctrl;
>
> + s->current_frame.data[0] = NULL;
> if (avctx->get_buffer(avctx, &s->current_frame)) {
> av_log(s->avctx, AV_LOG_ERROR, " Xan Video: get_buffer() failed\n");
> return -1;
> }
> - s->current_frame.reference = 3;
> + s->current_frame.reference = 1;
>
looks wrong
> if (!s->frame_size)
> s->frame_size = s->current_frame.linesize[0] * s->avctx->height;
>
> - palette_control->palette_changed = 0;
> - memcpy(s->current_frame.data[1], palette_control->palette,
> - AVPALETTE_SIZE);
> - s->current_frame.palette_has_changed = 1;
> + if (avctx->codec->id == CODEC_ID_XAN_WC3) {
> + palette_control->palette_changed = 0;
> + memcpy(s->current_frame.data[1], palette_control->palette,
> + AVPALETTE_SIZE);
> + s->current_frame.palette_has_changed = 1;
> + }
reindent
> @@ -407,6 +643,7 @@
>
> av_free(s->buffer1);
> av_free(s->buffer2);
> + av_free(s->buffer3);
av_freep
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The educated differ from the uneducated as much as the living from the
dead. -- Aristotle
-------------- 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/20091219/e6613244/attachment.pgp>
More information about the ffmpeg-devel
mailing list