| 120 | } |
| 121 | |
| 122 | static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) |
| 123 | { |
| 124 | MpegEncContext * const s = avctx->priv_data; |
| 125 | VASliceParameterBufferMPEG4 *slice_param; |
| 126 | |
| 127 | dprintf(avctx, "vaapi_mpeg4_decode_slice(): buffer %p, size %d\n", buffer, size); |
| 128 | |
| 129 | /* video_plane_with_short_video_header() contains all GOBs |
| 130 | * in-order, and this is what VA API (Intel backend) expects: only |
| 131 | * a single slice param. So fake macroblock_number for FFmpeg so |
| 132 | * that we don't call vaapi_mpeg4_decode_slice() again |
| 133 | */ |
| 134 | if (avctx->codec->id == CODEC_ID_H263) |
| 135 | size = s->gb.buffer_end - buffer; |
| 136 | |
| 137 | /* Fill in VASliceParameterBufferMPEG4 */ |
| 138 | slice_param = (VASliceParameterBufferMPEG4 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size); |
| 139 | if (!slice_param) |
| 140 | return -1; |
| 141 | slice_param->macroblock_offset = get_bits_count(&s->gb) % 8; |
| 142 | slice_param->macroblock_number = s->mb_y * s->mb_width + s->mb_x; |
| 143 | slice_param->quant_scale = s->qscale; |
| 144 | |
| 145 | if (avctx->codec->id == CODEC_ID_H263) |
| 146 | s->mb_y = s->mb_height; |
| 147 | |
| 148 | return 0; |
| 149 | } |
| 150 | |
| 151 | #if CONFIG_MPEG4_VAAPI_HWACCEL |
| 152 | AVHWAccel mpeg4_vaapi_hwaccel = { |
nothing calls this directly
no test coverage detected