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#ifndef _VLDXVMC_H 28cfcf9057Smrg#define _VLDXVMC_H 29cfcf9057Smrg 30cfcf9057Smrg#include <X11/Xlib.h> 31cfcf9057Smrg#include <X11/extensions/XvMC.h> 32cfcf9057Smrg 33cfcf9057Smrg/* 34cfcf9057Smrg * New "Motion compensation type". 35cfcf9057Smrg */ 36cfcf9057Smrg 37cfcf9057Smrg#define XVMC_VLD 0x0020000 38cfcf9057Smrg 39cfcf9057Smrg/* 40cfcf9057Smrg * Below Flags to be passed in the XvMCMpegControl structure 'flag' field. 41cfcf9057Smrg */ 42cfcf9057Smrg 43cfcf9057Smrg#define XVMC_PROGRESSIVE_SEQUENCE 0x00000010 44cfcf9057Smrg 45cfcf9057Smrg/* 46cfcf9057Smrg * Zig-Zag Scan / Alternative Scan. 47cfcf9057Smrg */ 48cfcf9057Smrg 49cfcf9057Smrg#define XVMC_ZIG_ZAG_SCAN 0x00000000 50cfcf9057Smrg#define XVMC_ALTERNATE_SCAN 0x00000100 51cfcf9057Smrg 52cfcf9057Smrg/* 53cfcf9057Smrg * Frame DCT and frame prediction are used. / 54cfcf9057Smrg * Field prediction 55cfcf9057Smrg */ 56cfcf9057Smrg 57cfcf9057Smrg#define XVMC_PRED_DCT_FRAME 0x00000040 58cfcf9057Smrg#define XVMC_PRED_DCT_FIELD 0x00000000 59cfcf9057Smrg 60cfcf9057Smrg/* 61cfcf9057Smrg * Top / Bottom field first 62cfcf9057Smrg */ 63cfcf9057Smrg 64cfcf9057Smrg#define XVMC_TOP_FIELD_FIRST 0x00000080 65cfcf9057Smrg#define XVMC_BOTTOM_FIELD_FIRST 0x00000000 66cfcf9057Smrg 67cfcf9057Smrg/* 68cfcf9057Smrg * Motion vectors coded in intra macroblocks 69cfcf9057Smrg */ 70cfcf9057Smrg 71cfcf9057Smrg#define XVMC_CONCEALMENT_MOTION_VECTORS 0x00000200 72cfcf9057Smrg 73cfcf9057Smrg/* 74cfcf9057Smrg * Which of two mappings between quantiser_scale_code 75cfcf9057Smrg * and quantiser_scale shall apply. 76cfcf9057Smrg */ 77cfcf9057Smrg 78cfcf9057Smrg#define XVMC_Q_SCALE_TYPE 0x00000400 79cfcf9057Smrg 80cfcf9057Smrg/* 81cfcf9057Smrg * Intra VLC Format: Bit = 0, Bit = 1 82cfcf9057Smrg * Intra blocks B-14 B-15 83cfcf9057Smrg * Non-intra blocks B-14 B-14 84cfcf9057Smrg */ 85cfcf9057Smrg#define XVMC_INTRA_VLC_FORMAT 0x00000800 86cfcf9057Smrg 87cfcf9057Smrg/* 88cfcf9057Smrg * Also XVMC_SECOND_FIELD should be set in flags if active. 89cfcf9057Smrg */ 90cfcf9057Smrg 91cfcf9057Smrg#define XVMC_I_PICTURE 1 92cfcf9057Smrg#define XVMC_P_PICTURE 2 93cfcf9057Smrg#define XVMC_B_PICTURE 3 94cfcf9057Smrg 950f57e2e1Smrgtypedef struct _XvMCMpegControl { 96cfcf9057Smrg unsigned 970f57e2e1Smrg BVMV_range, /* Backward vertical motion vector range */ 980f57e2e1Smrg BHMV_range, /* Backward horizontal motion vector range */ 990f57e2e1Smrg FVMV_range, /* Forward vertical motion vector range */ 1000f57e2e1Smrg FHMV_range, /* Forward horizontal motion vector range */ 1010f57e2e1Smrg picture_structure, /* XVMC_TOP_FIELD, XVMC_BOTTOM_FIELD, 1020f57e2e1Smrg * XVMC_FRAME_PICTURE 1030f57e2e1Smrg */ 1040f57e2e1Smrg intra_dc_precision, /* 0x00 - 0x03 corresponds to 8 to 11 bits prec. */ 1050f57e2e1Smrg picture_coding_type, /* XVMC_X_PICTURE */ 1060f57e2e1Smrg mpeg_coding, /* XVMC_MPEG_2 */ 1070f57e2e1Smrg flags; /* See above */ 1080f57e2e1Smrg} XvMCMpegControl; 109cfcf9057Smrg 110cfcf9057Smrg/* 111cfcf9057Smrg * The following function is called BEFORE starting sending slices to the 112cfcf9057Smrg * lib. It grabs the decoder hardware and prepares it for coming slices. 113cfcf9057Smrg * The function XvMCSyncSurface will release the hardware for other contexts 114cfcf9057Smrg * in addition to it's current functionality. 115cfcf9057Smrg */ 116cfcf9057Smrg 117cfcf9057Smrgextern Status XvMCBeginSurface(Display *display, 1180f57e2e1Smrg XvMCContext *context, 1190f57e2e1Smrg XvMCSurface *target_surface, 1200f57e2e1Smrg XvMCSurface *past_surface, 1210f57e2e1Smrg XvMCSurface *future_surface, 1220f57e2e1Smrg const XvMCMpegControl *control); 123cfcf9057Smrg 124cfcf9057Smrg/* 125cfcf9057Smrg * The quantizer matrix structure. This should be filled in by the user and 126cfcf9057Smrg * uploaded whenever a change is needed. The lib initializes with 127cfcf9057Smrg * default matrices and will automatically load the hardware with new matrices 128cfcf9057Smrg * on decoder context switches. To load data, set the corresponding load flag 129cfcf9057Smrg * to true and fill in the values. The VIA MPEG2 engine only uses the 130cfcf9057Smrg * intra_quantiser_matrix and the non_intra_quantiser_matrix. 131cfcf9057Smrg */ 132cfcf9057Smrg 133cfcf9057Smrgtypedef struct _XvMCQMatrix { 134cfcf9057Smrg int load_intra_quantiser_matrix; 135cfcf9057Smrg int load_non_intra_quantiser_matrix; 136cfcf9057Smrg int load_chroma_intra_quantiser_matrix; 137cfcf9057Smrg int load_chroma_non_intra_quantiser_matrix; 138cfcf9057Smrg unsigned char intra_quantiser_matrix[64]; 139cfcf9057Smrg unsigned char non_intra_quantiser_matrix[64]; 140cfcf9057Smrg unsigned char chroma_intra_quantiser_matrix[64]; 141cfcf9057Smrg unsigned char chroma_non_intra_quantiser_matrix[64]; 142cfcf9057Smrg} XvMCQMatrix; 143cfcf9057Smrg 144cfcf9057Smrg/* 145cfcf9057Smrg * Upload a XvMCQMatrix structure to the clientlib. 146cfcf9057Smrg * The hardware will start using it the next XvMCBeginSurface. 147cfcf9057Smrg */ 148cfcf9057Smrg 149cfcf9057Smrgextern Status XvMCLoadQMatrix(Display *display, XvMCContext *context, 1500f57e2e1Smrg const XvMCQMatrix *qmx); 151cfcf9057Smrg 152cfcf9057Smrg/* 153cfcf9057Smrg * Put a slice to the decoder. The hardware will start processing it 154cfcf9057Smrg * immediately. 155cfcf9057Smrg */ 156cfcf9057Smrg 1570f57e2e1Smrgextern Status XvMCPutSlice(Display *display, XvMCContext *context, 1580f57e2e1Smrg char *slice, int nBytes); 159cfcf9057Smrg/* 160cfcf9057Smrg * Put a slice without the slice start code to the decoder. 161cfcf9057Smrg * The hardware will start processing it 162cfcf9057Smrg * immediately. This function is for client optimization. 163cfcf9057Smrg * XvMCPutSlice(display,context,slice,nBytes) is equivalent to 164cfcf9057Smrg * XvMCPutSlice2(display,context,slice+4,nBytes-4,slice[3]); 165cfcf9057Smrg */ 166cfcf9057Smrg 1670f57e2e1Smrgextern Status XvMCPutSlice2(Display *display, XvMCContext *context, 1680f57e2e1Smrg char *slice, int nBytes, int sliceCode); 169cfcf9057Smrg 170cfcf9057Smrg#endif 171