[FFmpeg-devel] [PATCH] dstdec: big-endian compatiblity
Carl Eugen Hoyos
ceffmpeg at gmail.com
Sun Jan 6 13:57:37 EET 2019
2019-01-06 12:12 GMT+01:00, Peter Ross <pross at xvid.org>:
> for the '127-bit shift left' algorithm to work as intended, little-endian
> reads and writes must be used.
>
> libavcodec/dstdec.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c
> index 511861f4d2..e9653edc9f 100644
> --- a/libavcodec/dstdec.c
> +++ b/libavcodec/dstdec.c
> @@ -343,8 +343,15 @@ static int decode_frame(AVCodecContext *avctx, void
> *data,
> v = ((predict >> 15) ^ residual) & 1;
> dsd[((i >> 3) * channels + ch) << 2] |= v << (7 - (i & 0x7 ));
>
> - AV_WN64A(status + 8, (AV_RN64A(status + 8) << 1) |
> ((AV_RN64A(status) >> 63) & 1));
> - AV_WN64A(status, (AV_RN64A(status) << 1) | v);
> +#if HAVE_BIGENDIAN
> +#define RL64A AV_RL64
> +#define WL64A AV_WL64
> +#else
> +#define RL64A AV_RN64A
> +#define WL64A AV_WN64A
> +#endif
> + WL64A(status + 8, (RL64A(status + 8) << 1) | ((RL64A(status) >>
> 63) & 1));
> + WL64A(status, (RL64A(status) << 1) | v);
Why not using AV_WL64() and and AV_RL64()?
Is there a measurable speed difference?
Carl Eugen
More information about the ffmpeg-devel
mailing list