vldXvMC.h revision cfcf9057
1cfcf9057Smrg/***************************************************************************** 2cfcf9057Smrg * VLD XvMC Nonstandard extension API. 3cfcf9057Smrg * 4cfcf9057Smrg * Copyright (c) 2004 The Unichrome Project. All rights reserved. 5cfcf9057Smrg * 6cfcf9057Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7cfcf9057Smrg * copy of this software and associated documentation files (the "Software"), 8cfcf9057Smrg * to deal in the Software without restriction, including without limitation 9cfcf9057Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10cfcf9057Smrg * and/or sell copies of the Software, and to permit persons to whom the 11cfcf9057Smrg * Software is furnished to do so, subject to the following conditions: 12cfcf9057Smrg * 13cfcf9057Smrg * The above copyright notice and this permission notice shall be included in 14cfcf9057Smrg * all copies or substantial portions of the Software. 15cfcf9057Smrg * 16cfcf9057Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17cfcf9057Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18cfcf9057Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19cfcf9057Smrg * AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20cfcf9057Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21cfcf9057Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22cfcf9057Smrg * DEALINGS IN THE SOFTWARE. 23cfcf9057Smrg * 24cfcf9057Smrg * Author: Thomas Hellström, 2004. 25cfcf9057Smrg */ 26cfcf9057Smrg 27cfcf9057Smrg 28cfcf9057Smrg#ifndef _VLDXVMC_H 29cfcf9057Smrg#define _VLDXVMC_H 30cfcf9057Smrg 31cfcf9057Smrg#include <X11/Xlib.h> 32cfcf9057Smrg#include <X11/extensions/XvMC.h> 33cfcf9057Smrg 34cfcf9057Smrg/* 35cfcf9057Smrg * New "Motion compensation type". 36cfcf9057Smrg */ 37cfcf9057Smrg 38cfcf9057Smrg#define XVMC_VLD 0x0020000 39cfcf9057Smrg 40cfcf9057Smrg/* 41cfcf9057Smrg * Below Flags to be passed in the XvMCMpegControl structure 'flag' field. 42cfcf9057Smrg */ 43cfcf9057Smrg 44cfcf9057Smrg#define XVMC_PROGRESSIVE_SEQUENCE 0x00000010 45cfcf9057Smrg 46cfcf9057Smrg/* 47cfcf9057Smrg * Zig-Zag Scan / Alternative Scan. 48cfcf9057Smrg */ 49cfcf9057Smrg 50cfcf9057Smrg#define XVMC_ZIG_ZAG_SCAN 0x00000000 51cfcf9057Smrg#define XVMC_ALTERNATE_SCAN 0x00000100 52cfcf9057Smrg 53cfcf9057Smrg/* 54cfcf9057Smrg * Frame DCT and frame prediction are used. / 55cfcf9057Smrg * Field prediction 56cfcf9057Smrg */ 57cfcf9057Smrg 58cfcf9057Smrg#define XVMC_PRED_DCT_FRAME 0x00000040 59cfcf9057Smrg#define XVMC_PRED_DCT_FIELD 0x00000000 60cfcf9057Smrg 61cfcf9057Smrg/* 62cfcf9057Smrg * Top / Bottom field first 63cfcf9057Smrg */ 64cfcf9057Smrg 65cfcf9057Smrg#define XVMC_TOP_FIELD_FIRST 0x00000080 66cfcf9057Smrg#define XVMC_BOTTOM_FIELD_FIRST 0x00000000 67cfcf9057Smrg 68cfcf9057Smrg/* 69cfcf9057Smrg * Motion vectors coded in intra macroblocks 70cfcf9057Smrg */ 71cfcf9057Smrg 72cfcf9057Smrg#define XVMC_CONCEALMENT_MOTION_VECTORS 0x00000200 73cfcf9057Smrg 74cfcf9057Smrg/* 75cfcf9057Smrg * Which of two mappings between quantiser_scale_code 76cfcf9057Smrg * and quantiser_scale shall apply. 77cfcf9057Smrg */ 78cfcf9057Smrg 79cfcf9057Smrg#define XVMC_Q_SCALE_TYPE 0x00000400 80cfcf9057Smrg 81cfcf9057Smrg/* 82cfcf9057Smrg * Intra VLC Format: Bit = 0, Bit = 1 83cfcf9057Smrg * Intra blocks B-14 B-15 84cfcf9057Smrg * Non-intra blocks B-14 B-14 85cfcf9057Smrg */ 86cfcf9057Smrg#define XVMC_INTRA_VLC_FORMAT 0x00000800 87cfcf9057Smrg 88cfcf9057Smrg/* 89cfcf9057Smrg * Also XVMC_SECOND_FIELD should be set in flags if active. 90cfcf9057Smrg */ 91cfcf9057Smrg 92cfcf9057Smrg#define XVMC_I_PICTURE 1 93cfcf9057Smrg#define XVMC_P_PICTURE 2 94cfcf9057Smrg#define XVMC_B_PICTURE 3 95cfcf9057Smrg 96cfcf9057Smrgtypedef struct _XvMCMpegControl{ 97cfcf9057Smrg unsigned 98cfcf9057Smrg BVMV_range, /* Backward vertical motion vector range */ 99cfcf9057Smrg BHMV_range, /* Backward horizontal motion vector range */ 100cfcf9057Smrg FVMV_range, /* Forward vertical motion vector range */ 101cfcf9057Smrg FHMV_range, /* Forward horizontal motion vector range */ 102cfcf9057Smrg picture_structure, /* XVMC_TOP_FIELD, XVMC_BOTTOM_FIELD, 103cfcf9057Smrg * XVMC_FRAME_PICTURE 104cfcf9057Smrg */ 105cfcf9057Smrg intra_dc_precision, /* 0x00 - 0x03 corresponds to 8 to 11 bits prec. */ 106cfcf9057Smrg picture_coding_type,/* XVMC_X_PICTURE */ 107cfcf9057Smrg mpeg_coding, /* XVMC_MPEG_2 */ 108cfcf9057Smrg flags; /* See above */ 109cfcf9057Smrg}XvMCMpegControl; 110cfcf9057Smrg 111cfcf9057Smrg 112cfcf9057Smrg/* 113cfcf9057Smrg * The following function is called BEFORE starting sending slices to the 114cfcf9057Smrg * lib. It grabs the decoder hardware and prepares it for coming slices. 115cfcf9057Smrg * The function XvMCSyncSurface will release the hardware for other contexts 116cfcf9057Smrg * in addition to it's current functionality. 117cfcf9057Smrg */ 118cfcf9057Smrg 119cfcf9057Smrgextern Status XvMCBeginSurface(Display *display, 120cfcf9057Smrg XvMCContext *context, 121cfcf9057Smrg XvMCSurface *target_surface, 122cfcf9057Smrg XvMCSurface *past_surface, 123cfcf9057Smrg XvMCSurface *future_surface, 124cfcf9057Smrg const XvMCMpegControl *control); 125cfcf9057Smrg 126cfcf9057Smrg 127cfcf9057Smrg/* 128cfcf9057Smrg * The quantizer matrix structure. This should be filled in by the user and 129cfcf9057Smrg * uploaded whenever a change is needed. The lib initializes with 130cfcf9057Smrg * default matrices and will automatically load the hardware with new matrices 131cfcf9057Smrg * on decoder context switches. To load data, set the corresponding load flag 132cfcf9057Smrg * to true and fill in the values. The VIA MPEG2 engine only uses the 133cfcf9057Smrg * intra_quantiser_matrix and the non_intra_quantiser_matrix. 134cfcf9057Smrg */ 135cfcf9057Smrg 136cfcf9057Smrgtypedef struct _XvMCQMatrix { 137cfcf9057Smrg int load_intra_quantiser_matrix; 138cfcf9057Smrg int load_non_intra_quantiser_matrix; 139cfcf9057Smrg int load_chroma_intra_quantiser_matrix; 140cfcf9057Smrg int load_chroma_non_intra_quantiser_matrix; 141cfcf9057Smrg unsigned char intra_quantiser_matrix[64]; 142cfcf9057Smrg unsigned char non_intra_quantiser_matrix[64]; 143cfcf9057Smrg unsigned char chroma_intra_quantiser_matrix[64]; 144cfcf9057Smrg unsigned char chroma_non_intra_quantiser_matrix[64]; 145cfcf9057Smrg} XvMCQMatrix; 146cfcf9057Smrg 147cfcf9057Smrg/* 148cfcf9057Smrg * Upload a XvMCQMatrix structure to the clientlib. 149cfcf9057Smrg * The hardware will start using it the next XvMCBeginSurface. 150cfcf9057Smrg */ 151cfcf9057Smrg 152cfcf9057Smrgextern Status XvMCLoadQMatrix(Display *display, XvMCContext *context, 153cfcf9057Smrg const XvMCQMatrix *qmx); 154cfcf9057Smrg 155cfcf9057Smrg 156cfcf9057Smrg/* 157cfcf9057Smrg * Put a slice to the decoder. The hardware will start processing it 158cfcf9057Smrg * immediately. 159cfcf9057Smrg */ 160cfcf9057Smrg 161cfcf9057Smrgextern Status XvMCPutSlice(Display *display,XvMCContext *context, 162cfcf9057Smrg char *slice, int nBytes); 163cfcf9057Smrg/* 164cfcf9057Smrg * Put a slice without the slice start code to the decoder. 165cfcf9057Smrg * The hardware will start processing it 166cfcf9057Smrg * immediately. This function is for client optimization. 167cfcf9057Smrg * XvMCPutSlice(display,context,slice,nBytes) is equivalent to 168cfcf9057Smrg * XvMCPutSlice2(display,context,slice+4,nBytes-4,slice[3]); 169cfcf9057Smrg */ 170cfcf9057Smrg 171cfcf9057Smrgextern Status XvMCPutSlice2(Display *display,XvMCContext *context, 172cfcf9057Smrg char *slice, int nBytes, int sliceCode); 173cfcf9057Smrg 174cfcf9057Smrg#endif 175