[FFmpeg-user] What's the purpose of bswap_buf() function?

Vasily Postnicov shamaz.mazum at gmail.com
Mon Feb 15 07:43:55 EET 2021


Thanks a lot. I thought for some reason that bswap is for 16-bit values.

вс, 14 февр. 2021 г. в 22:31, Carl Eugen Hoyos <ceffmpeg at gmail.com>:
>
> Am So., 14. Feb. 2021 um 19:07 Uhr schrieb Vasily Postnicov
> <shamaz.mazum at gmail.com>:
> >
> > Hello. I try to add APE decoder support to my own library of audio
> > codecs. Since APE is a closed format, I use ffmpeg as a reference
> > trying to understand how it works.
>
> > I cannot understand how this line works in libavcodec/apedec.c:
> > s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf, buf_size >> 2);
> > I thought it swaps even and odd bytes,
>
> No, bswap_buf() is about doing a byte swap on 32bit data, what
> you describe would be a byte swap on 16 bit data.
>
> > but it does something more than
> > that. It's written in assembly code which I can not read clearly.
>
> A debugger has many disadvantages over running git grep:
> See libavcodec/bswapdsp.c and libavutil/bswap.h
>
> > Also it lacks any documentation.
>
> The function is only for internal use and byte swapping is
> assumed to be common knowledge, FFmpeg is supposed
> to run on both little- and big-endian hardware.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list