Hi,

On Thu, Jan 12, 2012 at 12:29 PM, Janne Grunau <[email protected]> wrote:
> On 2012-01-12 12:03:14 -0800, Ronald S. Bultje wrote:
>> From: "Ronald S. Bultje" <[email protected]>
>>
>> Fixes problems in swscale-test where it gives a 3-member array to a
>> function expecting a 4-member array. Secondly, fixes problems where
>> rgbToRgbWrapper() is called even though it doesn't support this
>> particular conversion (e.g. converting from RGB444 to anything).
>> Thirdly, fixes issues where rgbToRgbWrapper() is called for non-native
>> endiannness conversions (e.g. RGB555BE on a LE system). Fourthly,
>> fixes crashes when converting from e.g. monowhite to monowhite, which
>> calls planarCopyWrapper() and overwrites/reads because a n_bytes !=
>> n_pixels.
>> ---
>>  libswscale/swscale-test.c     |    4 +-
>>  libswscale/swscale_unscaled.c |   47 
>> +++++++++++++++++++++++-----------------
>>  2 files changed, 29 insertions(+), 22 deletions(-)
>>
>> diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c
>> index 7ea01a6..3497dff 100644
>> --- a/libswscale/swscale-test.c
>> +++ b/libswscale/swscale-test.c
>> @@ -337,8 +337,8 @@ int main(int argc, char **argv)
>>      enum PixelFormat srcFormat = PIX_FMT_NONE;
>>      enum PixelFormat dstFormat = PIX_FMT_NONE;
>>      uint8_t *rgb_data   = av_malloc(W * H * 4);
>> -    uint8_t *rgb_src[3] = { rgb_data, NULL, NULL };
>> -    int rgb_stride[3]   = { 4 * W, 0, 0 };
>> +    uint8_t *rgb_src[4] = { rgb_data, NULL, NULL, NULL };
>> +    int rgb_stride[4]   = { 4 * W, 0, 0, 0 };
>>      uint8_t *data       = av_malloc(4 * W * H);
>>      uint8_t *src[4]     = { data, data + W * H, data + W * H * 2, data + W 
>> * H * 3 };
>>      int stride[4]       = { W, W, W, W };
>
> care to split this from the rest. ok

Hm, I have a headache today, maybe tomorrow...

>> diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
>> index a1b7199..de9e77d 100644
>> --- a/libswscale/swscale_unscaled.c
>> +++ b/libswscale/swscale_unscaled.c
>> @@ -352,17 +352,20 @@ static int palToRgbWrapper(SwsContext *c, const 
>> uint8_t *src[], int srcStride[],
>>          )
>>
>>  /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
>> -static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int 
>> srcStride[],
>> -                           int srcSliceY, int srcSliceH, uint8_t *dst[],
>> -                           int dstStride[])
>> +typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int);
>> +static rgbConvFn findRgbConvFn(SwsContext *c)
>>  {
>>      const enum PixelFormat srcFormat = c->srcFormat;
>>      const enum PixelFormat dstFormat = c->dstFormat;
>> -    const int srcBpp = (c->srcFormatBpp + 7) >> 3;
>> -    const int dstBpp = (c->dstFormatBpp + 7) >> 3;
>>      const int srcId = c->srcFormatBpp;
>>      const int dstId = c->dstFormatBpp;
>> -    void (*conv)(const uint8_t *src, uint8_t *dst, int src_size) = NULL;
>> +    rgbConvFn conv = NULL;
>> +
>> +#define IS_NNE(bpp, fmt) \
>
> This macro needs either a comment or a different name. even NOT_NE
> would be an improvement

Changed.

>> +    (((bpp + 7) >> 3) == 2 && \
>> +     (!(av_pix_fmt_descriptors[fmt].flags & PIX_FMT_BE) != !HAVE_BIGENDIAN))
>
> why the double negative? HAVE_BIGENDIAN is guaranteed 0 or 1

Yeah, and so is PIX_FMT_BE actually... I didn't want to rely on a flag
having a specific value so it was either !!... != ..., or !... != !...
- I chose the second. Feel free to suggest a modification that's more
readable, like I said, headachy...

> and please add an empty line after the macro

Done.

New patch in a separate git send-email invocation.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to