* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "mpegutils.h"
#include "vaapi_internal.h"
-#include "dsputil.h"
/** Reconstruct bitstream f_code */
static inline int mpeg2_get_f_code(MpegEncContext *s)
{
- return ((s->mpeg_f_code[0][0] << 12) | (s->mpeg_f_code[0][1] << 8) |
- (s->mpeg_f_code[1][0] << 4) | s->mpeg_f_code[1][1]);
+ return (s->mpeg_f_code[0][0] << 12) | (s->mpeg_f_code[0][1] << 8) |
+ (s->mpeg_f_code[1][0] << 4) | s->mpeg_f_code[1][1];
}
/** Determine frame start: first field for field picture or frame picture */
switch (s->pict_type) {
case AV_PICTURE_TYPE_B:
- pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture);
+ pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f);
// fall-through
case AV_PICTURE_TYPE_P:
- pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture);
+ pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture.f);
break;
}
return 0;
}
-static int vaapi_mpeg2_end_frame(AVCodecContext *avctx)
-{
- return ff_vaapi_common_end_frame(avctx->priv_data);
-}
-
static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
{
MpegEncContext * const s = avctx->priv_data;
return -1;
slice_param->macroblock_offset = macroblock_offset;
slice_param->slice_horizontal_position = s->mb_x;
- slice_param->slice_vertical_position = s->mb_y;
+ slice_param->slice_vertical_position = s->mb_y >> (s->picture_structure != PICT_FRAME);
slice_param->quantiser_scale_code = quantiser_scale_code;
slice_param->intra_slice_flag = intra_slice_flag;
return 0;
AVHWAccel ff_mpeg2_vaapi_hwaccel = {
.name = "mpeg2_vaapi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG2VIDEO,
- .pix_fmt = PIX_FMT_VAAPI_VLD,
- .capabilities = 0,
+ .id = AV_CODEC_ID_MPEG2VIDEO,
+ .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
.start_frame = vaapi_mpeg2_start_frame,
- .end_frame = vaapi_mpeg2_end_frame,
+ .end_frame = ff_vaapi_mpeg_end_frame,
.decode_slice = vaapi_mpeg2_decode_slice,
- .priv_data_size = 0,
};