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

Function bink_decode_plane

libavcodec/bink.c:1020–1253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1018}
1019
1020static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
1021 int plane_idx, int is_chroma)
1022{
1023 int blk, ret;
1024 int i, j, bx, by;
1025 uint8_t *dst, *prev, *ref_start, *ref_end;
1026 int v, col[2];
1027 const uint8_t *scan;
1028 LOCAL_ALIGNED_32(int16_t, block, [64]);
1029 LOCAL_ALIGNED_16(uint8_t, ublock, [64]);
1030 LOCAL_ALIGNED_16(int32_t, dctblock, [64]);
1031 int coordmap[64], quant_idx, coef_count, coef_idx[64];
1032
1033 const int stride = frame->linesize[plane_idx];
1034 int bw = is_chroma ? (c->avctx->width + 15) >> 4 : (c->avctx->width + 7) >> 3;
1035 int bh = is_chroma ? (c->avctx->height + 15) >> 4 : (c->avctx->height + 7) >> 3;
1036 int width = c->avctx->width >> is_chroma;
1037 int height = c->avctx->height >> is_chroma;
1038
1039 if (c->version == 'k' && get_bits1(gb)) {
1040 int fill = get_bits(gb, 8);
1041
1042 dst = frame->data[plane_idx];
1043
1044 for (i = 0; i < height; i++)
1045 memset(dst + i * stride, fill, width);
1046 goto end;
1047 }
1048
1049 init_lengths(c, FFMAX(width, 8), bw);
1050 for (i = 0; i < BINK_NB_SRC; i++) {
1051 ret = read_bundle(gb, c, i);
1052 if (ret < 0)
1053 return ret;
1054 }
1055
1056 ref_start = c->last->data[plane_idx] ? c->last->data[plane_idx]
1057 : frame->data[plane_idx];
1058 ref_end = ref_start
1059 + (bw - 1 + c->last->linesize[plane_idx] * (bh - 1)) * 8;
1060
1061 for (i = 0; i < 64; i++)
1062 coordmap[i] = (i & 7) + (i >> 3) * stride;
1063
1064 for (by = 0; by < bh; by++) {
1065 if ((ret = read_block_types(c->avctx, gb, &c->bundle[BINK_SRC_BLOCK_TYPES])) < 0)
1066 return ret;
1067 if ((ret = read_block_types(c->avctx, gb, &c->bundle[BINK_SRC_SUB_BLOCK_TYPES])) < 0)
1068 return ret;
1069 if ((ret = read_colors(gb, &c->bundle[BINK_SRC_COLORS], c)) < 0)
1070 return ret;
1071 if ((ret = read_patterns(c->avctx, gb, &c->bundle[BINK_SRC_PATTERN])) < 0)
1072 return ret;
1073 if ((ret = read_motion_values(c->avctx, gb, &c->bundle[BINK_SRC_X_OFF])) < 0)
1074 return ret;
1075 if ((ret = read_motion_values(c->avctx, gb, &c->bundle[BINK_SRC_Y_OFF])) < 0)
1076 return ret;
1077 if ((ret = read_dcs(c->avctx, gb, &c->bundle[BINK_SRC_INTRA_DC], DC_START_BITS, 0)) < 0)

Callers 1

decode_frameFunction · 0.85

Calls 15

get_bits1Function · 0.85
init_lengthsFunction · 0.85
read_bundleFunction · 0.85
read_block_typesFunction · 0.85
read_colorsFunction · 0.85
read_patternsFunction · 0.85
read_motion_valuesFunction · 0.85
read_dcsFunction · 0.85
read_runsFunction · 0.85
get_bits_leftFunction · 0.85
av_logFunction · 0.85
read_dct_coeffsFunction · 0.85

Tested by

no test coverage detected