diff options
Diffstat (limited to 'libavcodec/vaapi_mpeg4.c')
-rw-r--r-- | libavcodec/vaapi_mpeg4.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c index 6743e2a..725f00b 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 */ @@ -46,7 +46,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; @@ -120,27 +120,17 @@ 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; - /* 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; } @@ -153,6 +143,9 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = { .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 @@ -165,5 +158,8 @@ AVHWAccel ff_h263_vaapi_hwaccel = { .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 |