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

Function vaapi_mpeg2_decode_slice

libavcodec/vaapi_mpeg2.c:107–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
108{
109 MpegEncContext * const s = avctx->priv_data;
110 VASliceParameterBufferMPEG2 *slice_param;
111 GetBitContext gb;
112 uint32_t start_code, quantiser_scale_code, intra_slice_flag, macroblock_offset;
113
114 dprintf(avctx, "vaapi_mpeg2_decode_slice(): buffer %p, size %d\n", buffer, size);
115
116 /* Determine macroblock_offset */
117 init_get_bits(&gb, buffer, 8 * size);
118 start_code = get_bits(&gb, 32);
119 assert((start_code & 0xffffff00) == 0x00000100);
120 quantiser_scale_code = get_bits(&gb, 5);
121 intra_slice_flag = get_bits1(&gb);
122 if (intra_slice_flag) {
123 skip_bits(&gb, 8);
124 while (get_bits1(&gb) != 0)
125 skip_bits(&gb, 8);
126 }
127 macroblock_offset = get_bits_count(&gb);
128
129 /* Fill in VASliceParameterBufferMPEG2 */
130 slice_param = (VASliceParameterBufferMPEG2 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);
131 if (!slice_param)
132 return -1;
133 slice_param->macroblock_offset = macroblock_offset;
134 slice_param->slice_horizontal_position = s->mb_x;
135 slice_param->slice_vertical_position = s->mb_y;
136 slice_param->quantiser_scale_code = quantiser_scale_code;
137 slice_param->intra_slice_flag = intra_slice_flag;
138 return 0;
139}
140
141AVHWAccel mpeg2_vaapi_hwaccel = {
142 .name = "mpeg2_vaapi",

Callers

nothing calls this directly

Calls 6

init_get_bitsFunction · 0.85
get_bitsFunction · 0.85
get_bits1Function · 0.85
skip_bitsFunction · 0.85
get_bits_countFunction · 0.85
ff_vaapi_alloc_sliceFunction · 0.85

Tested by

no test coverage detected