[FFmpeg-devel] [PATCH] Interplay Video decoder 16-bit support
Michael Niedermayer
michaelni
Thu Dec 24 17:15:08 CET 2009
On Wed, Dec 23, 2009 at 09:56:29PM +0200, Kostya wrote:
> Now this is done as extending existing decoder without introducing
> record-breaking long codec ID and new decoder.
>
> I've tried to follow current formatting conventions, but there's still
> some old formatting left to fix in that file.
> libavcodec/interplayvideo.c | 448 ++++++++++++++++++++++++++++++++++++++++++--
> libavformat/ipmovie.c | 7
> 2 files changed, 437 insertions(+), 18 deletions(-)
> cb6dde1b4520b580789c3deccc93589765de9acb ipv16.patch
> Index: libavcodec/interplayvideo.c
> ===================================================================
> --- libavcodec/interplayvideo.c (revision 20915)
> +++ libavcodec/interplayvideo.c (working copy)
> @@ -67,8 +67,11 @@
> const unsigned char *buf;
> int size;
>
> + int is_16bpp;
> const unsigned char *stream_ptr;
> const unsigned char *stream_end;
> + const uint8_t *mv_ptr;
> + const uint8_t *mv_end;
> unsigned char *pixel_ptr;
> int line_inc;
> int stride;
> @@ -83,10 +86,19 @@
> return -1; \
> }
>
> +#define CHECK_MV_PTR(n) \
> + if (s->mv_end - s->mv_ptr < n) { \
> + av_log(s->avctx, AV_LOG_ERROR, "Interplay video warning: mv_ptr out of bounds (%p >= %p)\n", \
> + s->mv_ptr + n, s->mv_end); \
> + return -1; \
> + }
duplicate of CHECK_STREAM_PTR
and there might be more stuff that an be merged
> +
> +
> static int copy_from(IpvideoContext *s, AVFrame *src, int delta_x, int delta_y)
> {
> int current_offset = s->pixel_ptr - s->current_frame.data[0];
> - int motion_offset = current_offset + delta_y * s->stride + delta_x;
> + int motion_offset = current_offset + delta_x * (1 + s->is_16bpp)
> + + delta_y * s->current_frame.linesize[0];
> if (motion_offset < 0) {
> av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset < 0 (%d)\n", motion_offset);
> return -1;
> @@ -95,7 +107,8 @@
> motion_offset, s->upper_motion_limit_offset);
> return -1;
> }
> - s->dsp.put_pixels_tab[1][0](s->pixel_ptr, src->data[0] + motion_offset, s->stride, 8);
> + s->dsp.put_pixels_tab[!s->is_16bpp][0](s->pixel_ptr, src->data[0] + motion_offset,
> + s->current_frame.linesize[0], 8);
the switch from stride ->linesize should possibly be seperate
[...]
above is just quick review, ill try to do a more complete one when i have
more time
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> ... defining _GNU_SOURCE...
For the love of all that is holy, and some that is not, don't do that.
-- Luca & Mans
-------------- 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/20091224/56860df5/attachment.pgp>
More information about the ffmpeg-devel
mailing list