[FFmpeg-cvslog] lavfi/super2xsai: fix fate test on bigendian

Stefano Sabatini stefasab at gmail.com
Sun Jun 17 12:26:47 CEST 2012


On date Saturday 2012-06-16 16:34:26 +0200, Paul B Mahol wrote:
> ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Jun 16 09:35:05 2012 +0000| [fd8def92488921d475a7ceff341eaf4cfb009f9b] | committer: Paul B Mahol
> 
> lavfi/super2xsai: fix fate test on bigendian
> 
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd8def92488921d475a7ceff341eaf4cfb009f9b
> ---
> 
>  libavfilter/vf_super2xsai.c        |   29 +++++++++++++++++++++--------
>  tests/ref/lavfi/pixfmts_super2xsai |    4 ++++
>  2 files changed, 25 insertions(+), 8 deletions(-)
> 
> diff --git a/libavfilter/vf_super2xsai.c b/libavfilter/vf_super2xsai.c
> index e342078..1b0b6a0 100644
> --- a/libavfilter/vf_super2xsai.c
> +++ b/libavfilter/vf_super2xsai.c
> @@ -40,6 +40,7 @@ typedef struct {
>      uint32_t q_lo_pixel_mask;
>  
>      int bpp; ///< bytes per pixel, pixel stride for each (packed) pixel
> +    int is_be;
>  } Super2xSaIContext;
>  
>  #define GET_RESULT(A, B, C, D) ((A != C || A != D) - (B != C || B != D))
> @@ -72,7 +73,7 @@ static void super2xsai(AVFilterContext *ctx,
>  
>  #define READ_COLOR4(dst, src_line, off) dst = *((const uint32_t *)src_line + off)
>  #define READ_COLOR3(dst, src_line, off) dst = AV_RL24 (src_line + 3*off)
> -#define READ_COLOR2(dst, src_line, off) dst = *((const uint16_t *)src_line + off)
> +#define READ_COLOR2(dst, src_line, off) dst = sai->is_be ? AV_RB16(src_line + 2 * off) : AV_RL16(src_line + 2 * off)
>  
>      for (y = 0; y < height; y++) {
>          uint8_t *dst_line[2];
> @@ -175,8 +176,13 @@ static void super2xsai(AVFilterContext *ctx,
>                  AV_WL24(dst_line[1] + x * 6 + 3, product2b);
>                  break;
>              default: // bpp = 2
> -                AV_WN32A(dst_line[0] + x * 4, product1a | (product1b << 16));
> -                AV_WN32A(dst_line[1] + x * 4, product2a | (product2b << 16));
> +                if (sai->is_be) {
> +                    AV_WB32(dst_line[0] + x * 4, product1a | (product1b << 16));
> +                    AV_WB32(dst_line[1] + x * 4, product2a | (product2b << 16));
> +                } else {
> +                    AV_WL32(dst_line[0] + x * 4, product1a | (product1b << 16));
> +                    AV_WL32(dst_line[1] + x * 4, product2a | (product2b << 16));
> +                }

This may have a performance hit, but maybe the difference is not very
significant.

The alternative was to only support native formats, and create
specific tests for the BE/LE cases.

[...]

Thanks.
-- 
FFmpeg = Furious and Fantastic Most Portentous Earthshaking Gymnast


More information about the ffmpeg-cvslog mailing list