* Copy (unaligned) bits from gb/data/size to pb. * * @param pb target buffer to copy bits into * @param data source buffer to copy bits from * @param size size of the source data, in bytes * @param gb bit I/O context specifying the current position in the source. * data. This function might use this to align the bit position to * a whole-byte boundary before calling #ff_
| 1890 | * I/O context is undefined. |
| 1891 | */ |
| 1892 | static void copy_bits(PutBitContext *pb, |
| 1893 | const uint8_t *data, int size, |
| 1894 | GetBitContext *gb, int nbits) |
| 1895 | { |
| 1896 | int rmn_bytes, rmn_bits; |
| 1897 | |
| 1898 | rmn_bits = rmn_bytes = get_bits_left(gb); |
| 1899 | if (rmn_bits < nbits) |
| 1900 | return; |
| 1901 | if (nbits > put_bits_left(pb)) |
| 1902 | return; |
| 1903 | rmn_bits &= 7; rmn_bytes >>= 3; |
| 1904 | if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0) |
| 1905 | put_bits(pb, rmn_bits, get_bits(gb, rmn_bits)); |
| 1906 | ff_copy_bits(pb, data + size - rmn_bytes, |
| 1907 | FFMIN(nbits - rmn_bits, rmn_bytes << 3)); |
| 1908 | } |
| 1909 | |
| 1910 | /** |
| 1911 | * Packet decoding: a packet is anything that the (ASF) demuxer contains, |
no test coverage detected