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

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions | Variables
vdpau_mpeg4.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_mpeg4_decoder_s

## Macros
#define | LOG_MODULE "vdpau_mpeg4"
#define | begin_vo_start_code 0x00
#define | end_vo_start_code 0x1f
#define | begin_vol_start_code 0x20
#define | end_vol_start_code 0x2f
#define | viso_sequence_start_code 0xb0
#define | viso_sequence_end_code 0xb1
#define | viso_start_code 0xb5
#define | group_start_code 0xb3
#define | user_data_start_code 0xb2
#define | vop_start_code 0xb6
#define | I_FRAME 0
#define | P_FRAME 1
#define | B_FRAME 2
#define | PICTURE_TOP 1
#define | PICTURE_BOTTOM 2
#define | PICTURE_FRAME 3
#define | SHAPE_RECT 0
#define | SHAPE_BIN 1
#define | SHAPE_BINONLY 2
#define | SHAPE_GRAY 3
#define | SPRITE_STATIC 1
#define | SPRITE_GMC 2
#define | ROUNDED_DIV(a, b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))

## Typedefs
typedef struct vdpau_mpeg4_decoder_s | vdpau_mpeg4_decoder_t

## Functions
static void | reset_picture (picture_t *pic)
static void | init_picture (picture_t *pic)
static void | reset_sequence (sequence_t *sequence, int free_refs)
static void | free_sequence (sequence_t *sequence)
static void | update_metadata (vdpau_mpeg4_decoder_t *this_gen)
static void | visual_object (vdpau_mpeg4_decoder_t *this_gen, uint8_t *buf, int len)
static void | video_object_layer (vdpau_mpeg4_decoder_t *this_gen, uint8_t *buf, int len)
static void | video_object_plane (vdpau_mpeg4_decoder_t *this_gen, uint8_t *buf, int len)
static void | gop_header (vdpau_mpeg4_decoder_t *this_gen, uint8_t *buf, int len)
static void | user_data (vdpau_mpeg4_decoder_t *this_gen, uint8_t *buffer, int len)
static int | parse_code (vdpau_mpeg4_decoder_t *this_gen, uint8_t *buf, int len)
static void | decode_render (vdpau_mpeg4_decoder_t *vd, vdpau_accel_t *accel, uint8_t *buf, int len)
static void | decode_picture (vdpau_mpeg4_decoder_t *vd)
static void | vdpau_mpeg4_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
static void | vdpau_mpeg4_flush (video_decoder_t *this_gen)
static void | vdpau_mpeg4_reset (video_decoder_t *this_gen)
static void | vdpau_mpeg4_discontinuity (video_decoder_t *this_gen)
static void | vdpau_mpeg4_dispose (video_decoder_t *this_gen)
static video_decoder_t * | open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream)
void * | mpeg4_init_plugin (xine_t *xine, const void *data)

## Variables
static int | nframe
static const uint8_t | default_intra_quantizer_matrix [64]
static const uint8_t | default_non_intra_quantizer_matrix [64]
uint8_t | mpeg_scan_norm [64]

## Macro Definition Documentation

## ◆ B_FRAME

#define B_FRAME 2

## ◆ begin_vo_start_code

#define begin_vo_start_code 0x00

## ◆ begin_vol_start_code

#define begin_vol_start_code 0x20

## ◆ end_vo_start_code

#define end_vo_start_code 0x1f

## ◆ end_vol_start_code

#define end_vol_start_code 0x2f

## ◆ group_start_code

#define group_start_code 0xb3

## ◆ I_FRAME

#define I_FRAME 0

## ◆ LOG_MODULE

#define LOG_MODULE "vdpau_mpeg4"

## ◆ P_FRAME

#define P_FRAME 1

## ◆ PICTURE_BOTTOM

#define PICTURE_BOTTOM 2

## ◆ PICTURE_FRAME

#define PICTURE_FRAME 3

## ◆ PICTURE_TOP

#define PICTURE_TOP 1

## ◆ ROUNDED_DIV

#define ROUNDED_DIV | ( |  | a,
|  |  | b
| ) |  | (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))

## ◆ SHAPE_BIN

#define SHAPE_BIN 1

## ◆ SHAPE_BINONLY

#define SHAPE_BINONLY 2

## ◆ SHAPE_GRAY

#define SHAPE_GRAY 3

## ◆ SHAPE_RECT

#define SHAPE_RECT 0

## ◆ SPRITE_GMC

#define SPRITE_GMC 2

## ◆ SPRITE_STATIC

#define SPRITE_STATIC 1

## ◆ user_data_start_code

#define user_data_start_code 0xb2

## ◆ viso_sequence_end_code

#define viso_sequence_end_code 0xb1

## ◆ viso_sequence_start_code

#define viso_sequence_start_code 0xb0

## ◆ viso_start_code

#define viso_start_code 0xb5

## ◆ vop_start_code

#define vop_start_code 0xb6

## Typedef Documentation

## ◆ vdpau_mpeg4_decoder_t

typedef struct vdpau_mpeg4_decoder_s vdpau_mpeg4_decoder_t

## Function Documentation

## ◆ decode_picture()

static void decode_picture | ( | vdpau_mpeg4_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::coded_height, sequence_t::coded_width, sequence_t::color_matrix, vdpau_accel_t::current_vdp_runtime_nr, decode_render(), vdpau_mpeg4_decoder_s::decoder, vo_frame_s::draw, vo_frame_s::drawn, vo_frame_s::duration, sequence_t::forward_ref, vo_frame_s::free, xine_video_port_s::get_frame, I_FRAME, NULL, P_FRAME, sequence_t::picture, sequence_t::profile, vo_frame_s::progressive_frame, vo_frame_s::pts, sequence_t::ratio, sequence_t::seq_pts, vdpau_mpeg4_decoder_s::sequence, vdpau_mpeg4_decoder_s::stream, vdpau_accel_t::surface, vo_frame_s::top_field_first, sequence_t::vdp_runtime_nr, xine_stream_s::video_out, sequence_t::video_step, VO_BOTH_FIELDS, and XINE_IMGFMT_VDPAU.

Referenced by vdpau_mpeg4_decode_data().

## ◆ decode_render()

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

References CAST_VdpPictureInfo_PTR, sequence_t::coded_height, sequence_t::coded_width, vdpau_mpeg4_decoder_s::decoder, vdpau_mpeg4_decoder_s::decoder_height, vdpau_mpeg4_decoder_s::decoder_profile, vdpau_mpeg4_decoder_s::decoder_width, vdpau_accel_t::lock, lprintf, nframe, sequence_t::picture, sequence_t::profile, sequence_t::seq_pts, vdpau_mpeg4_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, sequence_t::vdp_runtime_nr, vdpau_accel_t::vdp_runtime_nr, and vdpau_accel_t::vo_frame.

Referenced by decode_picture().

## ◆ free_sequence()

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

References sequence_t::chroma, sequence_t::codec_name, sequence_t::have_codec_name, sequence_t::have_header, lprintf, sequence_t::profile, reset_sequence(), and sequence_t::video_step.

Referenced by open_plugin(), and vdpau_mpeg4_dispose().

## ◆ gop_header()

static void gop_header | ( | vdpau_mpeg4_decoder_t * | this_gen,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References bits_reader_set(), sequence_t::br, read_bits(), vdpau_mpeg4_decoder_s::sequence, skip_bits(), and sequence_t::time_base.

Referenced by parse_code().

## ◆ init_picture()

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

References reset_picture().

Referenced by open_plugin().

## ◆ mpeg4_init_plugin()

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

References N_, NULL, open_plugin(), and video_decoder_class_s::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, free_sequence(), xine_video_port_s::get_capabilities, xine_video_port_s::get_frame, init_picture(), vdpau_accel_t::lock, lprintf, nframe, 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_mpeg4_decode_data(), vdpau_mpeg4_discontinuity(), vdpau_mpeg4_dispose(), vdpau_mpeg4_flush(), vdpau_mpeg4_reset(), xine_stream_s::video_out, VO_BOTH_FIELDS, VO_CAP_VDPAU_MPEG4, vdpau_accel_t::vo_frame, VO_GET_FRAME_MAY_FAIL, VO_NEW_SEQUENCE_FLAG, and XINE_IMGFMT_VDPAU.

Referenced by mpeg4_init_plugin().

## ◆ parse_code()

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

References begin_vol_start_code, end_vo_start_code, end_vol_start_code, gop_header(), group_start_code, sequence_t::have_header, lprintf, vdpau_mpeg4_decoder_s::sequence, user_data(), user_data_start_code, video_object_layer(), video_object_plane(), viso_sequence_end_code, viso_sequence_start_code, viso_start_code, visual_object(), and vop_start_code.

Referenced by vdpau_mpeg4_decode_data().

## ◆ reset_picture()

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

References picture_t::complexity_estimation_disable, lprintf, picture_t::newpred_enable, picture_t::progressive_frame, picture_t::quant_precision, picture_t::reduced_resolution_vop_enable, SHAPE_RECT, picture_t::vdp_infos, picture_t::viso_verid, and picture_t::vol_shape.

Referenced by init_picture().

## ◆ reset_sequence()

static void reset_sequence | ( | sequence_t * | sequence,
|  | int | free_refs
| ) |  |
| static

References sequence_t::backward_ref, sequence_t::bufpos, sequence_t::bufseek, sequence_t::cur_pts, sequence_t::forward_ref, vo_frame_s::free, sequence_t::last_non_b_time, sequence_t::last_time_base, NULL, vo_frame_s::pts, sequence_t::reset, sequence_t::seq_pts, sequence_t::start, sequence_t::t_frame, sequence_t::time, sequence_t::time_base, sequence_t::top_field_first, and VO_NEW_SEQUENCE_FLAG.

Referenced by free_sequence(), vdpau_mpeg4_discontinuity(), and vdpau_mpeg4_reset().

## ◆ update_metadata()

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

References _x_meta_info_set_utf8(), _x_stream_info_set(), xine_format_change_data_t::aspect, sequence_t::codec_name, sequence_t::coded_height, sequence_t::coded_width, xine_format_change_data_t::height, sequence_t::ratio, vdpau_mpeg4_decoder_s::sequence, vdpau_mpeg4_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 user_data(), and video_object_layer().

## ◆ user_data()

static void user_data | ( | vdpau_mpeg4_decoder_t * | this_gen,
|  | uint8_t * | buffer,
|  | int | len
| ) |  |
| static

References sequence_t::codec_name, sequence_t::have_codec_name, vdpau_mpeg4_decoder_s::sequence, and update_metadata().

Referenced by __attribute__(), _alsa_dev_name_cb(), _alsa_mmap_cb(), _alsa_speaker_arrangement_cb(), _new_entry_cb(), _x_vo_scale_init(), _x_vo_scale_redraw_needed(), alphablend_disable_exact_osd_alpha_blending_changed(), ao_ticket_revoked(), choose_speed_over_accuracy_cb(), directfb_frame_output_cb(), dri_cb(), event_handler(), event_handler_external(), ff_gain_cb(), gain_cb(), jack_speaker_arrangement_cb(), metronom_register_speed_change_callback(), metronom_unregister_speed_change_callback(), oss_speaker_arrangement_cb(), parse_code(), pgx64_config_changed(), raw_display_frame(), raw_open_plugin(), raw_overlay_end(), skip_loop_filter_enum_cb(), thread_count_cb(), ticket_revoke_cb_register(), ticket_revoke_cb_unregister(), update_fast_memcpy(), vcd_flush_buffers(), vcd_force_redisplay(), vcd_set_aspect_ratio(), vcd_update_title_display(), vdec_hw_h264_new(), vdpau_h264_alter_frame_delete(), vdpau_h264_alter_frame_new(), vdpau_h264_alter_frame_ready(), vdpau_h264_alter_frame_render(), vo_ticket_revoked(), xine_event_create_listener_thread(), XINE_FORMAT_PRINTF(), xine_register_log_cb(), xshm_open_plugin_2(), xv_default_lock_display(), and xv_default_unlock_display().

## ◆ vdpau_mpeg4_decode_data()

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

References sequence_t::buf, BUF_FLAG_PREVIEW, sequence_t::bufpos, sequence_t::bufseek, sequence_t::bufsize, buf_element_s::content, sequence_t::cur_pts, decode_picture(), buf_element_s::decoder_flags, parse_code(), buf_element_s::pts, buf_element_s::size, sequence_t::start, and xine_fast_memcpy.

Referenced by open_plugin().

## ◆ vdpau_mpeg4_discontinuity()

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

References lprintf, and reset_sequence().

Referenced by open_plugin().

## ◆ vdpau_mpeg4_dispose()

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

References free_sequence(), and lprintf.

Referenced by open_plugin().

## ◆ vdpau_mpeg4_flush()

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

References lprintf.

Referenced by open_plugin().

## ◆ vdpau_mpeg4_reset()

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

References lprintf, and reset_sequence().

Referenced by open_plugin().

## ◆ video_object_layer()

static void video_object_layer | ( | vdpau_mpeg4_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, default_intra_quantizer_matrix, default_non_intra_quantizer_matrix, sequence_t::fixed_vop_time_increment, sequence_t::have_header, lprintf, mpeg_scan_norm, sequence_t::picture, sequence_t::ratio, read_bits(), vdpau_mpeg4_decoder_s::sequence, SHAPE_BINONLY, SHAPE_GRAY, SHAPE_RECT, skip_bits(), SPRITE_GMC, SPRITE_STATIC, sequence_t::t_frame, sequence_t::time_increment_bits, update_metadata(), picture_t::vdp_infos, and sequence_t::video_step.

Referenced by parse_code().

## ◆ video_object_plane()

static void video_object_plane | ( | vdpau_mpeg4_decoder_t * | this_gen,
|  | uint8_t * | buf,
|  | int | len
| ) |  |
| static

References B_FRAME, bits_reader_set(), sequence_t::br, sequence_t::cur_pts, get_bits(), I_FRAME, sequence_t::last_non_b_time, sequence_t::last_time_base, P_FRAME, sequence_t::picture, read_bits(), ROUNDED_DIV, sequence_t::seq_pts, vdpau_mpeg4_decoder_s::sequence, SHAPE_BINONLY, SHAPE_GRAY, SHAPE_RECT, skip_bits(), sequence_t::t_frame, sequence_t::time, sequence_t::time_base, and sequence_t::time_increment_bits.

Referenced by parse_code().

## ◆ visual_object()

static void visual_object | ( | vdpau_mpeg4_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, read_bits(), vdpau_mpeg4_decoder_s::sequence, skip_bits(), and VO_SET_FLAGS_CM.

Referenced by parse_code().

## Variable Documentation

## ◆ default_intra_quantizer_matrix

const uint8_t default_intra_quantizer_matrix[64]
| static

Initial value:
= {
8,
17, 17,
20, 18, 18,
19, 19, 21, 21,
22, 22, 22, 21, 21,
23, 23, 23, 23, 23, 23,
25, 24, 24, 24, 24, 25, 25,
27, 27, 26, 26, 26, 26, 26, 27,
28, 28, 28, 28, 28, 28, 28,
30, 30, 30, 30, 30, 30,
32, 32, 32, 32, 32,
35, 35, 35, 35,
38, 38, 38,
41, 41,
45
}

Referenced by video_object_layer().

## ◆ default_non_intra_quantizer_matrix

const uint8_t default_non_intra_quantizer_matrix[64]
| static

Initial value:
= {
16,
17, 17,
18, 18, 18,
19, 19, 19, 19,
20, 20, 20, 20, 20,
21, 21, 21, 21, 21, 21,
22, 22, 22, 22, 22, 22, 22,
23, 23, 23, 23, 23, 23, 23, 23,
24, 24, 24, 25, 24, 24, 24,
25, 26, 26, 26, 26, 25,
27, 27, 27, 27, 27,
28, 28, 28, 28,
30, 30, 30,
31, 31,
33
}

Referenced by video_object_layer().

## ◆ mpeg_scan_norm

uint8_t mpeg_scan_norm[64]

Initial value:
= {
0, 1, 8,16, 9, 2, 3,10,
17,24,32,25,18,11, 4, 5,
12,19,26,33,40,48,41,34,
27,20,13, 6, 7,14,21,28,
35,42,49,56,57,50,43,36,
29,22,15,23,30,37,44,51,
58,59,52,45,38,31,39,46,
53,60,61,54,47,55,62,63
}

Referenced by video_object_layer().

## ◆ nframe

int nframe
| static

Referenced by decode_render(), and open_plugin().