| | 84 | |
|---|
| | 85 | /***************************************************************************** |
|---|
| | 86 | * Xxmc defines |
|---|
| | 87 | *****************************************************************************/ |
|---|
| | 88 | |
|---|
| | 89 | #ifdef MODULE_NAME_IS_xvmc |
|---|
| | 90 | |
|---|
| | 91 | typedef struct |
|---|
| | 92 | { /* CLUT == Color LookUp Table */ |
|---|
| | 93 | uint8_t cb; |
|---|
| | 94 | uint8_t cr; |
|---|
| | 95 | uint8_t y; |
|---|
| | 96 | uint8_t foo; |
|---|
| | 97 | } clut_t; |
|---|
| | 98 | |
|---|
| | 99 | #define XX44_PALETTE_SIZE 32 |
|---|
| | 100 | #define OVL_PALETTE_SIZE 256 |
|---|
| | 101 | #define XVMC_MAX_SURFACES 16 |
|---|
| | 102 | #define XVMC_MAX_SUBPICTURES 4 |
|---|
| | 103 | #define FOURCC_IA44 0x34344149 |
|---|
| | 104 | #define FOURCC_AI44 0x34344941 |
|---|
| | 105 | |
|---|
| | 106 | typedef struct |
|---|
| | 107 | { |
|---|
| | 108 | unsigned size; |
|---|
| | 109 | unsigned max_used; |
|---|
| | 110 | uint32_t cluts[XX44_PALETTE_SIZE]; |
|---|
| | 111 | /* cache palette entries for both colors and clip_colors */ |
|---|
| | 112 | int lookup_cache[OVL_PALETTE_SIZE*2]; |
|---|
| | 113 | } xx44_palette_t; |
|---|
| | 114 | |
|---|
| | 115 | /* |
|---|
| | 116 | * Functions to handle the vlc-specific palette. |
|---|
| | 117 | */ |
|---|
| | 118 | |
|---|
| | 119 | void clear_xx44_palette( xx44_palette_t *p ); |
|---|
| | 120 | |
|---|
| | 121 | /* |
|---|
| | 122 | * Convert the xine-specific palette to something useful. |
|---|
| | 123 | */ |
|---|
| | 124 | |
|---|
| | 125 | void xx44_to_xvmc_palette( const xx44_palette_t *p,unsigned char *xvmc_palette, |
|---|
| | 126 | unsigned first_xx44_entry, unsigned num_xx44_entries, |
|---|
| | 127 | unsigned num_xvmc_components, char *xvmc_components ); |
|---|
| | 128 | |
|---|
| | 129 | typedef struct |
|---|
| | 130 | { |
|---|
| | 131 | vlc_macroblocks_t vlc_mc; |
|---|
| | 132 | XvMCBlockArray blocks; /* pointer to memory for dct block array */ |
|---|
| | 133 | int num_blocks; |
|---|
| | 134 | XvMCMacroBlock *macroblockptr; /* pointer to current macro block */ |
|---|
| | 135 | XvMCMacroBlock *macroblockbaseptr; /* pointer to base MacroBlock in MB array */ |
|---|
| | 136 | XvMCMacroBlockArray macro_blocks; /* pointer to memory for macroblock array */ |
|---|
| | 137 | int slices; |
|---|
| | 138 | } xvmc_macroblocks_t; |
|---|
| | 139 | |
|---|
| | 140 | typedef struct |
|---|
| | 141 | { |
|---|
| | 142 | unsigned int mpeg_flags; |
|---|
| | 143 | unsigned int accel_flags; |
|---|
| | 144 | unsigned int max_width; |
|---|
| | 145 | unsigned int max_height; |
|---|
| | 146 | unsigned int sub_max_width; |
|---|
| | 147 | unsigned int sub_max_height; |
|---|
| | 148 | int type_id; |
|---|
| | 149 | XvImageFormatValues subPicType; |
|---|
| | 150 | int flags; |
|---|
| | 151 | } xvmc_capabilities_t; |
|---|
| | 152 | |
|---|
| | 153 | typedef struct xvmc_surface_handler_s |
|---|
| | 154 | { |
|---|
| | 155 | XvMCSurface surfaces[XVMC_MAX_SURFACES]; |
|---|
| | 156 | int surfInUse[XVMC_MAX_SURFACES]; |
|---|
| | 157 | int surfValid[XVMC_MAX_SURFACES]; |
|---|
| | 158 | XvMCSubpicture subpictures[XVMC_MAX_SUBPICTURES]; |
|---|
| | 159 | int subInUse[XVMC_MAX_SUBPICTURES]; |
|---|
| | 160 | int subValid[XVMC_MAX_SUBPICTURES]; |
|---|
| | 161 | pthread_mutex_t mutex; |
|---|
| | 162 | } xvmc_surface_handler_t; |
|---|
| | 163 | |
|---|
| | 164 | typedef struct context_lock_s |
|---|
| | 165 | { |
|---|
| | 166 | pthread_mutex_t mutex; |
|---|
| | 167 | pthread_cond_t cond; |
|---|
| | 168 | int num_readers; |
|---|
| | 169 | } context_lock_t; |
|---|
| | 170 | |
|---|
| | 171 | #define XVMCLOCKDISPLAY(display) XLockDisplay(display); |
|---|
| | 172 | #define XVMCUNLOCKDISPLAY(display) XUnlockDisplay(display); |
|---|
| | 173 | |
|---|
| | 174 | void xvmc_context_reader_unlock( context_lock_t *c ); |
|---|
| | 175 | void xvmc_context_reader_lock( context_lock_t *c ); |
|---|
| | 176 | void xvmc_context_writer_lock( context_lock_t *c ); |
|---|
| | 177 | void xvmc_context_writer_unlock( context_lock_t *c ); |
|---|
| | 178 | void free_context_lock( context_lock_t *c ); |
|---|
| | 179 | void xxmc_dispose_context( vout_thread_t *p_vout ); |
|---|
| | 180 | |
|---|
| | 181 | int xxmc_xvmc_surface_valid( vout_thread_t *p_vout, XvMCSurface *surf ); |
|---|
| | 182 | void xxmc_xvmc_free_surface( vout_thread_t *p_vout, XvMCSurface *surf ); |
|---|
| | 183 | |
|---|
| | 184 | void xvmc_vld_slice( picture_t *picture ); |
|---|
| | 185 | void xvmc_vld_frame( picture_t *picture ); |
|---|
| | 186 | |
|---|
| | 187 | void xxmc_do_update_frame( picture_t *picture, uint32_t width, uint32_t height, |
|---|
| | 188 | double ratio, int format, int flags); |
|---|
| | 189 | |
|---|
| | 190 | int checkXvMCCap( vout_thread_t *p_vout); |
|---|
| | 191 | |
|---|
| | 192 | XvMCSubpicture *xxmc_xvmc_alloc_subpicture( vout_thread_t *p_vout, |
|---|
| | 193 | XvMCContext *context, unsigned short width, unsigned short height, |
|---|
| | 194 | int xvimage_id ); |
|---|
| | 195 | |
|---|
| | 196 | void xxmc_xvmc_free_subpicture( vout_thread_t *p_vout, XvMCSubpicture *sub ); |
|---|
| | 197 | void blend_xx44( uint8_t *dst_img, subpicture_t *sub_img, int dst_width, |
|---|
| | 198 | int dst_height, int dst_pitch, xx44_palette_t *palette,int ia44); |
|---|
| | 199 | |
|---|
| | 200 | #endif /* XvMC defines */ |
|---|
| 277 | | /***************************************************************************** |
|---|
| 278 | | * Xxmc defines |
|---|
| 279 | | *****************************************************************************/ |
|---|
| 280 | | |
|---|
| 281 | | #ifdef MODULE_NAME_IS_xvmc |
|---|
| 282 | | |
|---|
| 283 | | typedef struct |
|---|
| 284 | | { /* CLUT == Color LookUp Table */ |
|---|
| 285 | | uint8_t cb; |
|---|
| 286 | | uint8_t cr; |
|---|
| 287 | | uint8_t y; |
|---|
| 288 | | uint8_t foo; |
|---|
| 289 | | } clut_t; |
|---|
| 290 | | |
|---|
| 291 | | #define XX44_PALETTE_SIZE 32 |
|---|
| 292 | | #define OVL_PALETTE_SIZE 256 |
|---|
| 293 | | #define XVMC_MAX_SURFACES 16 |
|---|
| 294 | | #define XVMC_MAX_SUBPICTURES 4 |
|---|
| 295 | | #define FOURCC_IA44 0x34344149 |
|---|
| 296 | | #define FOURCC_AI44 0x34344941 |
|---|
| 297 | | |
|---|
| 298 | | typedef struct |
|---|
| 299 | | { |
|---|
| 300 | | unsigned size; |
|---|
| 301 | | unsigned max_used; |
|---|
| 302 | | uint32_t cluts[XX44_PALETTE_SIZE]; |
|---|
| 303 | | /* cache palette entries for both colors and clip_colors */ |
|---|
| 304 | | int lookup_cache[OVL_PALETTE_SIZE*2]; |
|---|
| 305 | | } xx44_palette_t; |
|---|
| 306 | | |
|---|
| 307 | | /* |
|---|
| 308 | | * Functions to handle the vlc-specific palette. |
|---|
| 309 | | */ |
|---|
| 310 | | |
|---|
| 311 | | void clear_xx44_palette( xx44_palette_t *p ); |
|---|
| 312 | | |
|---|
| 313 | | /* |
|---|
| 314 | | * Convert the xine-specific palette to something useful. |
|---|
| 315 | | */ |
|---|
| 316 | | |
|---|
| 317 | | void xx44_to_xvmc_palette( const xx44_palette_t *p,unsigned char *xvmc_palette, |
|---|
| 318 | | unsigned first_xx44_entry, unsigned num_xx44_entries, |
|---|
| 319 | | unsigned num_xvmc_components, char *xvmc_components ); |
|---|
| 320 | | |
|---|
| 321 | | typedef struct |
|---|
| 322 | | { |
|---|
| 323 | | vlc_macroblocks_t vlc_mc; |
|---|
| 324 | | XvMCBlockArray blocks; /* pointer to memory for dct block array */ |
|---|
| 325 | | int num_blocks; |
|---|
| 326 | | XvMCMacroBlock *macroblockptr; /* pointer to current macro block */ |
|---|
| 327 | | XvMCMacroBlock *macroblockbaseptr; /* pointer to base MacroBlock in MB array */ |
|---|
| 328 | | XvMCMacroBlockArray macro_blocks; /* pointer to memory for macroblock array */ |
|---|
| 329 | | int slices; |
|---|
| 330 | | } xvmc_macroblocks_t; |
|---|
| 331 | | |
|---|
| 332 | | typedef struct |
|---|
| 333 | | { |
|---|
| 334 | | unsigned int mpeg_flags; |
|---|
| 335 | | unsigned int accel_flags; |
|---|
| 336 | | unsigned int max_width; |
|---|
| 337 | | unsigned int max_height; |
|---|
| 338 | | unsigned int sub_max_width; |
|---|
| 339 | | unsigned int sub_max_height; |
|---|
| 340 | | int type_id; |
|---|
| 341 | | XvImageFormatValues subPicType; |
|---|
| 342 | | int flags; |
|---|
| 343 | | } xvmc_capabilities_t; |
|---|
| 344 | | |
|---|
| 345 | | typedef struct xvmc_surface_handler_s |
|---|
| 346 | | { |
|---|
| 347 | | XvMCSurface surfaces[XVMC_MAX_SURFACES]; |
|---|
| 348 | | int surfInUse[XVMC_MAX_SURFACES]; |
|---|
| 349 | | int surfValid[XVMC_MAX_SURFACES]; |
|---|
| 350 | | XvMCSubpicture subpictures[XVMC_MAX_SUBPICTURES]; |
|---|
| 351 | | int subInUse[XVMC_MAX_SUBPICTURES]; |
|---|
| 352 | | int subValid[XVMC_MAX_SUBPICTURES]; |
|---|
| 353 | | pthread_mutex_t mutex; |
|---|
| 354 | | } xvmc_surface_handler_t; |
|---|
| 355 | | |
|---|
| 356 | | typedef struct context_lock_s |
|---|
| 357 | | { |
|---|
| 358 | | pthread_mutex_t mutex; |
|---|
| 359 | | pthread_cond_t cond; |
|---|
| 360 | | int num_readers; |
|---|
| 361 | | } context_lock_t; |
|---|
| 362 | | |
|---|
| 363 | | #define XVMCLOCKDISPLAY(display) XLockDisplay(display); |
|---|
| 364 | | #define XVMCUNLOCKDISPLAY(display) XUnlockDisplay(display); |
|---|
| 365 | | |
|---|
| 366 | | void xvmc_context_reader_unlock( context_lock_t *c ); |
|---|
| 367 | | void xvmc_context_reader_lock( context_lock_t *c ); |
|---|
| 368 | | void xvmc_context_writer_lock( context_lock_t *c ); |
|---|
| 369 | | void xvmc_context_writer_unlock( context_lock_t *c ); |
|---|
| 370 | | void free_context_lock( context_lock_t *c ); |
|---|
| 371 | | void xxmc_dispose_context( vout_thread_t *p_vout ); |
|---|
| 372 | | |
|---|
| 373 | | int xxmc_xvmc_surface_valid( vout_thread_t *p_vout, XvMCSurface *surf ); |
|---|
| 374 | | void xxmc_xvmc_free_surface( vout_thread_t *p_vout, XvMCSurface *surf ); |
|---|
| 375 | | |
|---|
| 376 | | void xvmc_vld_slice( picture_t *picture ); |
|---|
| 377 | | void xvmc_vld_frame( picture_t *picture ); |
|---|
| 378 | | |
|---|
| 379 | | void xxmc_do_update_frame( picture_t *picture, uint32_t width, uint32_t height, |
|---|
| 380 | | double ratio, int format, int flags); |
|---|
| 381 | | |
|---|
| 382 | | int checkXvMCCap( vout_thread_t *p_vout); |
|---|
| 383 | | |
|---|
| 384 | | XvMCSubpicture *xxmc_xvmc_alloc_subpicture( vout_thread_t *p_vout, |
|---|
| 385 | | XvMCContext *context, unsigned short width, unsigned short height, |
|---|
| 386 | | int xvimage_id ); |
|---|
| 387 | | |
|---|
| 388 | | void xxmc_xvmc_free_subpicture( vout_thread_t *p_vout, XvMCSubpicture *sub ); |
|---|
| 389 | | void blend_xx44( uint8_t *dst_img, subpicture_t *sub_img, int dst_width, |
|---|
| 390 | | int dst_height, int dst_pitch, xx44_palette_t *palette,int ia44); |
|---|
| 391 | | |
|---|
| 392 | | #endif |
|---|
| | 395 | |
|---|