xine-lib: xine-lib-1.2.12/src/video_dec/libvdpau/vdpau_vc1.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions | Variables
vdpau_vc1.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <sys/types.h>`
`#include <unistd.h>`
`#include <xine/xine_internal.h>`
`#include <xine/video_out.h>`
`#include <xine/buffer.h>`
`#include <xine/xineutils.h>`
`#include "accel_vdpau.h"`
`#include "bits_reader.h"`
`#include "group_vdpau.h"`
`#include <vdpau/vdpau.h>`

## Data Structures
struct | picture_t
struct | sequence_t
struct | vdpau_vc1_decoder_s

## Macros
#define | LOG_MODULE "vdpau_vc1"
#define | sequence_header_code 0x0f
#define | sequence_end_code 0x0a
#define | entry_point_code 0x0e
#define | frame_start_code 0x0d
#define | field_start_code 0x0c
#define | slice_start_code 0x0b
#define | PICTURE_FRAME 0
#define | PICTURE_FRAME_INTERLACE 2
#define | PICTURE_FIELD_INTERLACE 3
#define | I_FRAME 0
#define | P_FRAME 1
#define | B_FRAME 3
#define | BI_FRAME 4
#define | FIELDS_I_I 0
#define | FIELDS_I_P 1
#define | FIELDS_P_I 2
#define | FIELDS_P_P 3
#define | FIELDS_B_B 4
#define | FIELDS_B_BI 5
#define | FIELDS_BI_B 6
#define | FIELDS_BI_BI 7
#define | MODE_STARTCODE 0
#define | MODE_FRAME 1

## Typedefs
typedef struct vdpau_vc1_decoder_s | vdpau_vc1_decoder_t

## Functions
static void | init_picture (picture_t *pic)
static void | reset_picture (picture_t *pic)
static void | reset_sequence (sequence_t *sequence)
static void | init_sequence (sequence_t *sequence)
static void | update_metadata (vdpau_vc1_decoder_t *this_gen)
static void | sequence_header_advanced (vdpau_vc1_decoder_t *this_gen, uint8_t *buf, int len)
static void | sequence_header (vdpau_vc1_decoder_t *this_gen, uint8_t *buf, int len)
static void | entry_point (vdpau_vc1_decoder_t *this_gen, uint8_t *buf, int len)
static void | picture_header (vdpau_vc1_decoder_t *this_gen, uint8_t *buf, int len)
static void | picture_header_advanced (vdpau_vc1_decoder_t *this_gen, uint8_t *buf, int len)
static void | parse_header (vdpau_vc1_decoder_t *this_gen, uint8_t *buf, int len)
static void | remove_emulation_prevention (uint8_t *src, uint8_t *dst, int src_len, int *dst_len)
static int | parse_code (vdpau_vc1_decoder_t *this_gen, uint8_t *buf, int len)
static void | decode_render (vdpau_vc1_decoder_t *vd, vdpau_accel_t *accel, uint8_t *buf, int len)
static int | search_field (vdpau_vc1_decoder_t *vd, uint8_t *buf, int len)
static void | decode_picture (vdpau_vc1_decoder_t *vd)
static void | vdpau_vc1_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
static void | vdpau_vc1_flush (video_decoder_t *this_gen)
static void | vdpau_vc1_reset (video_decoder_t *this_gen)
static void | vdpau_vc1_discontinuity (video_decoder_t *this_gen)
static void | vdpau_vc1_dispose (video_decoder_t *this_gen)
static video_decoder_t * | open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream)
void * | vc1_init_plugin (xine_t *xine, const void *data)

## Variables
const double | aspect_ratio []

## Macro Definition Documentation

## ◆ B_FRAME

#define B_FRAME 3

## ◆ BI_FRAME

#define BI_FRAME 4

## ◆ entry_point_code

#define entry_point_code 0x0e

## ◆ field_start_code

#define field_start_code 0x0c

## ◆ FIELDS_B_B

#define FIELDS_B_B 4

## ◆ FIELDS_B_BI

#define FIELDS_B_BI 5

## ◆ FIELDS_BI_B

#define FIELDS_BI_B 6

## ◆ FIELDS_BI_BI

#define FIELDS_BI_BI 7

## ◆ FIELDS_I_I

#define FIELDS_I_I 0

## ◆ FIELDS_I_P

#define FIELDS_I_P 1

## ◆ FIELDS_P_I

#define FIELDS_P_I 2

## ◆ FIELDS_P_P

#define FIELDS_P_P 3

## ◆ frame_start_code

#define frame_start_code 0x0d

## ◆ I_FRAME

#define I_FRAME 0

## ◆ LOG_MODULE

#define LOG_MODULE "vdpau_vc1"

## ◆ MODE_FRAME

#define MODE_FRAME 1

## ◆ MODE_STARTCODE

#define MODE_STARTCODE 0

## ◆ P_FRAME

#define P_FRAME 1

## ◆ PICTURE_FIELD_INTERLACE

#define PICTURE_FIELD_INTERLACE 3

## ◆ PICTURE_FRAME

#define PICTURE_FRAME 0

## ◆ PICTURE_FRAME_INTERLACE

#define PICTURE_FRAME_INTERLACE 2

## ◆ sequence_end_code

#define sequence_end_code 0x0a

## ◆ sequence_header_code

#define sequence_header_code 0x0f

## ◆ slice_start_code

#define slice_start_code 0x0b

## Typedef Documentation

## ◆ vdpau_vc1_decoder_t

typedef struct vdpau_vc1_decoder_s vdpau_vc1_decoder_t

## Function Documentation

## ◆ decode_picture()

static void decode_picture | ( | vdpau_vc1_decoder_t * | vd | ) |
| static

References vo_frame_s::accel_data, sequence_t::accel_vdpau, B_FRAME, sequence_t::backward_ref, vo_frame_s::bad_frame, sequence_t::buf, sequence_t::bufpos, sequence_t::bufseek, sequence_t::coded_height, sequence_t::coded_width, sequence_t::color_matrix, vdpau_accel_t::current_vdp_runtime_nr, decode_render(), vdpau_vc1_decoder_s::decoder, vo_frame_s::draw, vo_frame_s::drawn, vo_frame_s::duration, field, sequence_t::forward_ref, vo_frame_s::free, xine_video_port_s::get_frame, I_FRAME, lprintf, sequence_t::mode, MODE_FRAME, NULL, P_FRAME, sequence_t::picture, PICTURE_FIELD_INTERLACE, picture_header(), picture_header_advanced(), sequence_t::profile, vo_frame_s::progressive_frame, vo_frame_s::pts, sequence_t::ratio, remove_emulation_prevention(), reset_picture(), search_field(), sequence_t::seq_pts, vdpau_vc1_decoder_s::sequence, picture_t::slices, sequence_t::start, vdpau_vc1_decoder_s::stream, vdpau_accel_t::surface, vo_frame_s::top_field_first, picture_t::vdp_infos, sequence_t::vdp_runtime_nr, xine_stream_s::video_out, sequence_t::video_step, VO_BOTH_FIELDS, and XINE_IMGFMT_VDPAU.

Referenced by vdpau_vc1_decode_data().

## ◆ decode_render()

static void decode_render | ( | vdpau_vc1_decoder_t * | vd,
|  | vdpau_accel_t * | accel,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References vo_frame_s::accel_data, B_FRAME, sequence_t::backward_ref, BI_FRAME, CAST_VdpPictureInfo_PTR, sequence_t::coded_height, sequence_t::coded_width, vdpau_vc1_decoder_s::decoder, vdpau_vc1_decoder_s::decoder_height, vdpau_vc1_decoder_s::decoder_profile, vdpau_vc1_decoder_s::decoder_width, FIELDS_B_B, FIELDS_BI_B, FIELDS_I_I, FIELDS_I_P, FIELDS_P_I, FIELDS_P_P, I_FRAME, vdpau_accel_t::lock, lprintf, P_FRAME, sequence_t::picture, sequence_t::profile, sequence_t::seq_pts, vdpau_vc1_decoder_s::sequence, vdpau_accel_t::surface, vdpau_accel_t::unlock, vdpau_accel_t::vdp_decoder_create, vdpau_accel_t::vdp_decoder_destroy, vdpau_accel_t::vdp_decoder_render, vdpau_accel_t::vdp_device, vdpau_accel_t::vdp_get_error_string, picture_t::vdp_infos, sequence_t::vdp_runtime_nr, vdpau_accel_t::vdp_runtime_nr, and vdpau_accel_t::vo_frame.

Referenced by decode_picture().

## ◆ entry_point()

static void entry_point | ( | vdpau_vc1_decoder_t * | this_gen,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References bits_reader_set(), sequence_t::br, sequence_t::coded_height, sequence_t::coded_width, picture_t::hrd_num_leaky_buckets, picture_t::hrd_param_flag, lprintf, sequence_t::picture, read_bits(), vdpau_vc1_decoder_s::sequence, skip_bits(), and picture_t::vdp_infos.

Referenced by parse_code(), and parse_header().

## ◆ init_picture()

static void init_picture | ( | picture_t * | pic | ) |
| static

Referenced by open_plugin().

## ◆ init_sequence()

static void init_sequence | ( | sequence_t * | sequence | ) |
| static

References sequence_t::have_header, picture_t::hrd_param_flag, lprintf, sequence_t::picture, sequence_t::profile, sequence_t::ratio, reset_sequence(), and sequence_t::video_step.

Referenced by open_plugin().

## ◆ open_plugin()

static video_decoder_t * open_plugin | ( | video_decoder_class_t * | class_gen,
|  | xine_stream_t * | stream
| ) |  |
| static

References vo_frame_s::accel_data, vo_frame_s::free, xine_video_port_s::get_capabilities, xine_video_port_s::get_frame, init_picture(), init_sequence(), vdpau_accel_t::lock, lprintf, MODE_STARTCODE, NULL, xine_video_port_s::open, vdpau_accel_t::unlock, vdpau_accel_t::vdp_decoder_create, vdpau_accel_t::vdp_decoder_destroy, vdpau_accel_t::vdp_device, vdpau_accel_t::vdp_runtime_nr, vdpau_vc1_decode_data(), vdpau_vc1_discontinuity(), vdpau_vc1_dispose(), vdpau_vc1_flush(), vdpau_vc1_reset(), xine_stream_s::video_out, VO_BOTH_FIELDS, VO_CAP_VDPAU_VC1, vdpau_accel_t::vo_frame, VO_GET_FRAME_MAY_FAIL, and XINE_IMGFMT_VDPAU.

Referenced by vc1_init_plugin().

## ◆ parse_code()

static int parse_code | ( | vdpau_vc1_decoder_t * | this_gen,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References sequence_t::code_start, sequence_t::current_code, entry_point(), entry_point_code, field_start_code, frame_start_code, sequence_t::have_header, lprintf, sequence_t::picture, remove_emulation_prevention(), vdpau_vc1_decoder_s::sequence, sequence_end_code, sequence_header(), sequence_header_code, slice_start_code, and picture_t::slices.

Referenced by vdpau_vc1_decode_data().

## ◆ parse_header()

static void parse_header | ( | vdpau_vc1_decoder_t * | this_gen,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References entry_point(), entry_point_code, sequence_t::have_header, vdpau_vc1_decoder_s::sequence, sequence_header(), and sequence_header_code.

Referenced by vdpau_vc1_decode_data().

## ◆ picture_header()

static void picture_header | ( | vdpau_vc1_decoder_t * | this_gen,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References B_FRAME, bits_reader_set(), sequence_t::br, I_FRAME, lprintf, P_FRAME, sequence_t::picture, read_bits(), vdpau_vc1_decoder_s::sequence, skip_bits(), and picture_t::vdp_infos.

Referenced by decode_picture().

## ◆ picture_header_advanced()

static void picture_header_advanced | ( | vdpau_vc1_decoder_t * | this_gen,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References B_FRAME, BI_FRAME, bits_reader_set(), sequence_t::br, FIELDS_B_B, FIELDS_B_BI, FIELDS_I_I, FIELDS_I_P, FIELDS_P_I, FIELDS_P_P, I_FRAME, lprintf, P_FRAME, sequence_t::picture, PICTURE_FIELD_INTERLACE, PICTURE_FRAME, PICTURE_FRAME_INTERLACE, read_bits(), vdpau_vc1_decoder_s::sequence, skip_bits(), and picture_t::vdp_infos.

Referenced by decode_picture().

## ◆ remove_emulation_prevention()

static void remove_emulation_prevention | ( | uint8_t * | src,
|  | uint8_t * | dst,
|  | int | src_len,
|  | int * | dst_len
| ) |  |
| static

References lprintf.

Referenced by decode_picture(), and parse_code().

## ◆ reset_picture()

static void reset_picture | ( | picture_t * | pic | ) |
| static

References picture_t::slices.

Referenced by decode_picture(), and reset_sequence().

## ◆ reset_sequence()

static void reset_sequence | ( | sequence_t * | sequence | ) |
| static

References sequence_t::backward_ref, sequence_t::bufpos, sequence_t::bufseek, sequence_t::code_start, sequence_t::cur_pts, sequence_t::current_code, sequence_t::forward_ref, vo_frame_s::free, lprintf, NULL, sequence_t::picture, reset_picture(), sequence_t::seq_pts, and sequence_t::start.

Referenced by init_sequence(), vdpau_vc1_dispose(), and vdpau_vc1_reset().

## ◆ search_field()

static int search_field | ( | vdpau_vc1_decoder_t * | vd,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References field_start_code, and lprintf.

Referenced by decode_picture().

## ◆ sequence_header()

static void sequence_header | ( | vdpau_vc1_decoder_t * | this_gen,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References bits_reader_set(), sequence_t::br, sequence_t::color_matrix, lprintf, sequence_t::picture, sequence_t::profile, read_bits(), vdpau_vc1_decoder_s::sequence, sequence_header_advanced(), skip_bits(), update_metadata(), picture_t::vdp_infos, and VO_SET_FLAGS_CM.

Referenced by parse_code(), and parse_header().

## ◆ sequence_header_advanced()

static void sequence_header_advanced | ( | vdpau_vc1_decoder_t * | this_gen,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References bits_reader_set(), sequence_t::br, sequence_t::coded_height, sequence_t::coded_width, sequence_t::color_matrix, picture_t::hrd_num_leaky_buckets, picture_t::hrd_param_flag, lprintf, sequence_t::picture, sequence_t::profile, sequence_t::ratio, read_bits(), vdpau_vc1_decoder_s::sequence, skip_bits(), update_metadata(), picture_t::vdp_infos, sequence_t::video_step, and VO_SET_FLAGS_CM.

Referenced by sequence_header().

## ◆ update_metadata()

static void update_metadata | ( | vdpau_vc1_decoder_t * | this_gen | ) |
| static

References _x_meta_info_set_utf8(), _x_stream_info_set(), xine_format_change_data_t::aspect, sequence_t::coded_height, sequence_t::coded_width, sequence_t::have_header, xine_format_change_data_t::height, sequence_t::ratio, sequence_t::reported_video_step, vdpau_vc1_decoder_s::sequence, vdpau_vc1_decoder_s::stream, sequence_t::video_step, xine_format_change_data_t::width, XINE_EVENT_FRAME_FORMAT_CHANGE, xine_event_send(), XINE_META_INFO_VIDEOCODEC, XINE_STREAM_INFO_FRAME_DURATION, XINE_STREAM_INFO_VIDEO_HEIGHT, XINE_STREAM_INFO_VIDEO_RATIO, and XINE_STREAM_INFO_VIDEO_WIDTH.

Referenced by sequence_header(), and sequence_header_advanced().

## ◆ vc1_init_plugin()

void * vc1_init_plugin | ( | xine_t * | xine,
|  | const void * | data
| ) |  |

References N_, NULL, open_plugin(), and video_decoder_class_s::open_plugin.

## ◆ vdpau_vc1_decode_data()

static void vdpau_vc1_decode_data | ( | video_decoder_t * | this_gen,
|  | buf_element_t * | buf
| ) |  |
| static

References _x_stream_info_set(), xine_bmiheader::biHeight, xine_bmiheader::biWidth, sequence_t::buf, BUF_FLAG_ASPECT, BUF_FLAG_FRAME_END, BUF_FLAG_FRAME_START, BUF_FLAG_FRAMERATE, BUF_FLAG_HEADER, BUF_FLAG_PREVIEW, BUF_FLAG_STDHEADER, sequence_t::bufpos, sequence_t::bufseek, sequence_t::bufsize, sequence_t::code_start, sequence_t::coded_height, sequence_t::coded_width, buf_element_s::content, sequence_t::cur_pts, sequence_t::current_code, decode_picture(), buf_element_s::decoder_flags, buf_element_s::decoder_info, lprintf, sequence_t::mode, MODE_FRAME, MODE_STARTCODE, parse_code(), parse_header(), buf_element_s::pts, sequence_t::ratio, sequence_t::seq_pts, buf_element_s::size, sequence_t::start, xine_fast_memcpy, and XINE_STREAM_INFO_FRAME_DURATION.

Referenced by open_plugin().

## ◆ vdpau_vc1_discontinuity()

static void vdpau_vc1_discontinuity | ( | video_decoder_t * | this_gen | ) |
| static

References lprintf.

Referenced by open_plugin().

## ◆ vdpau_vc1_dispose()

static void vdpau_vc1_dispose | ( | video_decoder_t * | this_gen | ) |
| static

References lprintf, and reset_sequence().

Referenced by open_plugin().

## ◆ vdpau_vc1_flush()

static void vdpau_vc1_flush | ( | video_decoder_t * | this_gen | ) |
| static

References lprintf.

Referenced by open_plugin().

## ◆ vdpau_vc1_reset()

static void vdpau_vc1_reset | ( | video_decoder_t * | this_gen | ) |
| static

References lprintf, and reset_sequence().

Referenced by open_plugin().

## Variable Documentation

## ◆ aspect_ratio

const double aspect_ratio[]

Initial value:
= {
0.0,
1.0,
12./11.,
10./11.,
16./11.,
40./33.,
24./11.,
20./11.,
32./11.,
80./33.,
18./11.,
15./11.,
64./33.,
160./99.
}