MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / write_huff_codes

Function write_huff_codes

libavcodec/utvideoenc.c:364–392  ·  view source on GitHub ↗

Write huffman bit codes to a memory block */

Source from the content-addressed store, hash-verified

362
363/* Write huffman bit codes to a memory block */
364static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size,
365 int width, int height, HuffEntry *he)
366{
367 PutBitContext pb;
368 int i, j;
369 int count;
370
371 init_put_bits(&pb, dst, dst_size);
372
373 /* Write the codes */
374 for (j = 0; j < height; j++) {
375 for (i = 0; i < width; i++)
376 put_bits(&pb, he[src[i]].len, he[src[i]].code);
377
378 src += width;
379 }
380
381 /* Pad output to a 32-bit boundary */
382 count = put_bits_count(&pb) & 0x1F;
383
384 if (count)
385 put_bits(&pb, 32 - count, 0);
386
387 /* Flush the rest with zeroes */
388 flush_put_bits(&pb);
389
390 /* Return the amount of bytes written */
391 return put_bytes_output(&pb);
392}
393
394static int encode_plane(AVCodecContext *avctx, const uint8_t *src,
395 uint8_t *dst, ptrdiff_t stride, int plane_no,

Callers 1

encode_planeFunction · 0.85

Calls 5

init_put_bitsFunction · 0.85
put_bits_countFunction · 0.85
flush_put_bitsFunction · 0.85
put_bytes_outputFunction · 0.85
put_bitsFunction · 0.70

Tested by

no test coverage detected