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

Function vaapi_mjpeg_decode_slice

libavcodec/vaapi_mjpeg.c:73–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73static int vaapi_mjpeg_decode_slice(AVCodecContext *avctx,
74 const uint8_t *buffer,
75 uint32_t size)
76{
77 const MJpegDecodeContext *s = avctx->priv_data;
78 VAAPIDecodePicture *pic = s->hwaccel_picture_private;
79 VAHuffmanTableBufferJPEGBaseline huff;
80 VAIQMatrixBufferJPEGBaseline quant;
81 VASliceParameterBufferJPEGBaseline sp;
82 int err, i, j;
83
84 memset(&huff, 0, sizeof(huff));
85 for (i = 0; i < 2; i++) {
86 huff.load_huffman_table[i] = 1;
87 for (j = 0; j < 16; j++)
88 huff.huffman_table[i].num_dc_codes[j] = s->raw_huffman_lengths[0][i][j];
89 for (j = 0; j < 12; j++)
90 huff.huffman_table[i].dc_values[j] = s->raw_huffman_values[0][i][j];
91 for (j = 0; j < 16; j++)
92 huff.huffman_table[i].num_ac_codes[j] = s->raw_huffman_lengths[1][i][j];
93 for (j = 0; j < 162; j++)
94 huff.huffman_table[i].ac_values[j] = s->raw_huffman_values[1][i][j];
95 }
96
97 err = ff_vaapi_decode_make_param_buffer(avctx, pic,
98 VAHuffmanTableBufferType,
99 &huff, sizeof(huff));
100 if (err < 0)
101 goto fail;
102
103 memset(&quant, 0, sizeof(quant));
104 for (i = 0; i < 4; i++) {
105 quant.load_quantiser_table[i] = 1;
106 for (j = 0; j < 64; j++)
107 quant.quantiser_table[i][j] = s->quant_matrixes[i][j];
108 }
109
110 err = ff_vaapi_decode_make_param_buffer(avctx, pic,
111 VAIQMatrixBufferType,
112 &quant, sizeof(quant));
113 if (err < 0)
114 goto fail;
115
116 sp = (VASliceParameterBufferJPEGBaseline) {
117 .slice_data_size = size,
118 .slice_data_offset = 0,
119 .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
120
121 .slice_horizontal_position = 0,
122 .slice_vertical_position = 0,
123
124 .restart_interval = s->restart_interval,
125 .num_mcus = s->mb_width * s->mb_height,
126 };
127
128 sp.num_components = s->nb_components;
129 for (i = 0; i < s->nb_components; i++) {
130 sp.components[i].component_selector = s->component_id[s->comp_index[i]];

Callers

nothing calls this directly

Tested by

no test coverage detected