summaryrefslogtreecommitdiff
path: root/libavcodec/vaapi_mpeg4.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/vaapi_mpeg4.c')
-rw-r--r--libavcodec/vaapi_mpeg4.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
index 49d5f07e43..426bef2646 100644
--- a/libavcodec/vaapi_mpeg4.c
+++ b/libavcodec/vaapi_mpeg4.c
@@ -3,20 +3,20 @@
*
* Copyright (C) 2008-2009 Splitted-Desktop Systems
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -45,7 +45,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
{
Mpeg4DecContext *ctx = avctx->priv_data;
MpegEncContext * const s = &ctx->m;
- struct vaapi_context * const vactx = avctx->hwaccel_context;
+ FFVAContext * const vactx = ff_vaapi_get_context(avctx);
VAPictureParameterBufferMPEG4 *pic_param;
VAIQMatrixBufferMPEG4 *iq_matrix;
int i;
@@ -121,29 +121,19 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
{
MpegEncContext * const s = avctx->priv_data;
+ FFVAContext * const vactx = ff_vaapi_get_context(avctx);
VASliceParameterBufferMPEG4 *slice_param;
ff_dlog(avctx, "vaapi_mpeg4_decode_slice(): buffer %p, size %d\n", buffer, size);
- /* video_plane_with_short_video_header() contains all GOBs
- * in-order, and this is what VA API (Intel backend) expects: only
- * a single slice param. So fake macroblock_number for Libav so
- * that we don't call vaapi_mpeg4_decode_slice() again
- */
- if (avctx->codec->id == AV_CODEC_ID_H263)
- size = s->gb.buffer_end - buffer;
-
/* Fill in VASliceParameterBufferMPEG4 */
- slice_param = (VASliceParameterBufferMPEG4 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);
+ slice_param = (VASliceParameterBufferMPEG4 *)ff_vaapi_alloc_slice(vactx, buffer, size);
if (!slice_param)
return -1;
slice_param->macroblock_offset = get_bits_count(&s->gb) % 8;
- slice_param->macroblock_number = s->mb_y * s->mb_width + s->mb_x;
+ slice_param->macroblock_number = 0;
slice_param->quant_scale = s->qscale;
- if (avctx->codec->id == AV_CODEC_ID_H263)
- s->mb_y = s->mb_height;
-
return 0;
}
@@ -152,10 +142,13 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = {
.name = "mpeg4_vaapi",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_MPEG4,
- .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
+ .pix_fmt = AV_PIX_FMT_VAAPI,
.start_frame = vaapi_mpeg4_start_frame,
.end_frame = ff_vaapi_mpeg_end_frame,
.decode_slice = vaapi_mpeg4_decode_slice,
+ .init = ff_vaapi_context_init,
+ .uninit = ff_vaapi_context_fini,
+ .priv_data_size = sizeof(FFVAContext),
};
#endif
@@ -164,9 +157,12 @@ AVHWAccel ff_h263_vaapi_hwaccel = {
.name = "h263_vaapi",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_H263,
- .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
+ .pix_fmt = AV_PIX_FMT_VAAPI,
.start_frame = vaapi_mpeg4_start_frame,
.end_frame = ff_vaapi_mpeg_end_frame,
.decode_slice = vaapi_mpeg4_decode_slice,
+ .init = ff_vaapi_context_init,
+ .uninit = ff_vaapi_context_fini,
+ .priv_data_size = sizeof(FFVAContext),
};
#endif