1 /*
2 * MPEG-4 Part 2 / H.263 decode acceleration through VDPAU
3 *
4 * Copyright (c) 2008 NVIDIA
5 * Copyright (c) 2013 Rémi Denis-Courmont
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #include <vdpau/vdpau.h>
25
31
34 {
37 Picture *pic =
s->current_picture_ptr;
42
43 /* fill VdpPictureInfoMPEG4Part2 struct */
44 info->forward_reference = VDP_INVALID_HANDLE;
45 info->backward_reference = VDP_INVALID_HANDLE;
46 info->vop_coding_type = 0;
47
48 switch (
s->pict_type) {
51 assert(
ref != VDP_INVALID_HANDLE);
53 info->vop_coding_type = 2;
54 /* fall-through */
57 assert(
ref != VDP_INVALID_HANDLE);
59 }
60
61 info->trd[0] =
s->pp_time;
62 info->trb[0] =
s->pb_time;
63 info->trd[1] =
s->pp_field_time >> 1;
64 info->trb[1] =
s->pb_field_time >> 1;
65 info->vop_time_increment_resolution =
s->avctx->framerate.num;
66 info->vop_fcode_forward =
s->f_code;
67 info->vop_fcode_backward =
s->b_code;
68 info->resync_marker_disable = !
ctx->resync_marker;
69 info->interlaced = !
s->progressive_sequence;
70 info->quant_type =
s->mpeg_quant;
71 info->quarter_sample =
s->quarter_sample;
73 info->rounding_control =
s->no_rounding;
74 info->alternate_vertical_scan_flag =
s->alternate_scan;
75 info->top_field_first =
s->top_field_first;
76 for (
i = 0;
i < 64; ++
i) {
77 info->intra_quantizer_matrix[
i] =
s->intra_matrix[
i];
78 info->non_intra_quantizer_matrix[
i] =
s->inter_matrix[
i];
79 }
80
83 }
84
88 {
89 return 0;
90 }
91
93 {
95
98 profile = VDP_DECODER_PROFILE_MPEG4_PART2_SP;
99 break;
100 // As any ASP decoder must be able to decode SP, this
101 // should be a safe fallback if profile is unknown/unspecified.
104 profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
105 break;
106 default:
108 }
109
111 }
112
114 .
name =
"mpeg4_vdpau",
127 };