* 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_
| 1866 | * I/O context is undefined. |
| 1867 | */ |
| 1868 | static void copy_bits(PutBitContext *pb, |
| 1869 | const uint8_t *data, int size, |
| 1870 | GetBitContext *gb, int nbits) |
| 1871 | { |
| 1872 | int rmn_bytes, rmn_bits; |
| 1873 | |
| 1874 | rmn_bits = rmn_bytes = get_bits_left(gb); |
| 1875 | if (rmn_bits < nbits) |
| 1876 | return; |
| 1877 | rmn_bits &= 7; rmn_bytes >>= 3; |
| 1878 | if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0) |
| 1879 | put_bits(pb, rmn_bits, get_bits(gb, rmn_bits)); |
| 1880 | ff_copy_bits(pb, data + size - rmn_bytes, |
| 1881 | FFMIN(nbits - rmn_bits, rmn_bytes << 3)); |
| 1882 | } |
| 1883 | |
| 1884 | /** |
| 1885 | * Packet decoding: a packet is anything that the (ASF) demuxer contains, |
no test coverage detected