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

Function decode_byterun

libavcodec/iff.c:495–520  ·  view source on GitHub ↗

* Decode one complete byterun1 encoded line. * * @param dst the destination buffer where to store decompressed bitstream * @param dst_size the destination plane size in bytes * @param buf the source byterun1 compressed bitstream * @param buf_end the EOF of source byterun1 compressed bitstream * @return number of consumed bytes in byterun1 compressed bitstream */

Source from the content-addressed store, hash-verified

493 * @return number of consumed bytes in byterun1 compressed bitstream
494 */
495static int decode_byterun(uint8_t *dst, int dst_size,
496 GetByteContext *gb)
497{
498 unsigned x;
499 for (x = 0; x < dst_size && bytestream2_get_bytes_left(gb) > 0;) {
500 unsigned length;
501 const int8_t value = bytestream2_get_byte(gb);
502 if (value >= 0) {
503 length = FFMIN3(value + 1, dst_size - x, bytestream2_get_bytes_left(gb));
504 bytestream2_get_buffer(gb, dst + x, length);
505 if (length < value + 1)
506 bytestream2_skip(gb, value + 1 - length);
507 } else if (value > -128) {
508 length = FFMIN(-value + 1, dst_size - x);
509 memset(dst + x, bytestream2_get_byte(gb), length);
510 } else { // noop
511 continue;
512 }
513 x += length;
514 }
515 if (x < dst_size) {
516 av_log(NULL, AV_LOG_WARNING, "decode_byterun ended before plane size\n");
517 memset(dst+x, 0, dst_size - x);
518 }
519 return bytestream2_tell(gb);
520}
521
522static int decode_byterun2(uint8_t *dst, int height, int line_size,
523 GetByteContext *gb)

Callers 1

decode_frameFunction · 0.85

Calls 5

bytestream2_get_bufferFunction · 0.85
bytestream2_skipFunction · 0.85
av_logFunction · 0.85
bytestream2_tellFunction · 0.85

Tested by

no test coverage detected