[Libav-user] Fwd: Endianness of numerical values in h264 stream
Hendrik Leppkes
h.leppkes at gmail.com
Thu Dec 29 13:42:39 EET 2016
On Thu, Dec 29, 2016 at 12:32 PM, Слободенюк Александр Игоревич
<alenuke at yandex.ru> wrote:
> Greetings. Found strange thing in this code:
>
> static inline int decode_vui_parameters(H264Context *h, SPS *sps)
> {
> int aspect_ratio_info_present_flag;
> unsigned int aspect_ratio_idc;
>
> aspect_ratio_info_present_flag = get_bits1(&h->gb);
>
> if (aspect_ratio_info_present_flag) {
> aspect_ratio_idc = get_bits(&h->gb, 8);
> if (aspect_ratio_idc == EXTENDED_SAR) {
> sps->sar.num = get_bits(&h->gb, 16);
> sps->sar.den = get_bits(&h->gb, 16);
> ....
>
> "sps->sar.num" and "sps->sar.den" are 16-bit numerical values. This means
> they have endianness: little or big. As we can see, they are not swapping.
> So, the values "sps->sar.num" and "sps->sar.den" should read different on
> little and big endian systems..
> Could you please explain if I'm wrong?
>
get_bits handles all endianness concerns.
- Hendrik
More information about the Libav-user
mailing list