[FFmpeg-devel] [PATCH] lavc/sunrastenc: consider cases with linesize < 0
Michael Niedermayer
michaelni at gmx.at
Sun Mar 18 22:17:53 CET 2012
On Sun, Mar 18, 2012 at 09:58:55PM +0100, Stefano Sabatini wrote:
> On date Sunday 2012-03-18 18:18:40 +0100, Michael Niedermayer encoded:
> > On Sun, Mar 18, 2012 at 04:57:28PM +0100, Stefano Sabatini wrote:
> > > Make sunrast_image_write_image() deals with cases when linesize is < 0.
> > > Fix trac ticket #1077.
> > > ---
> > > libavcodec/sunrastenc.c | 4 ++--
> > > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > i think it would be simpler to add a y variable and test against height
> > instead of fliping < vs. > checks
>
> Updated.
> --
> FFmpeg = Faithless and Frightening Mega Problematic Entertaining Gymnast
> sunrastenc.c | 23 +++++++++++------------
> 1 file changed, 11 insertions(+), 12 deletions(-)
> 776607e645622a713d8eee8526d46f45699988f5 0002-lavc-sunrastenc-consider-cases-with-linesize-0.patch
> From 9c2790441478b85bfe7a09e6321edb6305f9a65a Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab at gmail.com>
> Date: Sun, 18 Mar 2012 16:55:53 +0100
> Subject: [PATCH] lavc/sunrastenc: consider cases with linesize < 0
>
> Make sunrast_image_write_image() deal with cases when linesize is < 0.
> Fix trac ticket #1077.
> ---
> libavcodec/sunrastenc.c | 23 +++++++++++------------
> 1 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/libavcodec/sunrastenc.c b/libavcodec/sunrastenc.c
> index a9b4749..53b956a 100644
> --- a/libavcodec/sunrastenc.c
> +++ b/libavcodec/sunrastenc.c
> @@ -56,7 +56,7 @@ static void sunrast_image_write_image(AVCodecContext *avctx,
> {
> SUNRASTContext *s = avctx->priv_data;
> const uint8_t *ptr;
> - int len, alen, x;
> + int len, alen, x, y;
>
> if (s->maplength) { // palettized
> PutByteContext pb_r, pb_g;
> @@ -83,32 +83,32 @@ static void sunrast_image_write_image(AVCodecContext *avctx,
> if (s->type == RT_BYTE_ENCODED) {
> uint8_t value, value2;
> int run;
> - const uint8_t *end = pixels + avctx->height * linesize;
>
> + y = 0;
> ptr = pixels;
>
> -#define GET_VALUE ptr >= end ? 0 : x >= len ? ptr[len-1] : ptr[x]
> +#define GET_VALUE(x) x >= FFABS(linesize) ? 0 : x >= len ? ptr[len-1] : ptr[x]
how can x become >= FFABS(linesize) ?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120318/2653a79e/attachment.asc>
More information about the ffmpeg-devel
mailing list