117ca54c3Smrg/***************************************************************************** 217ca54c3Smrg * VLD XvMC Nonstandard extension API. 317ca54c3Smrg * 417ca54c3Smrg * Copyright (c) 2004 The Unichrome Project. All rights reserved. 517ca54c3Smrg * 617ca54c3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 717ca54c3Smrg * copy of this software and associated documentation files (the "Software"), 817ca54c3Smrg * to deal in the Software without restriction, including without limitation 917ca54c3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1017ca54c3Smrg * and/or sell copies of the Software, and to permit persons to whom the 1117ca54c3Smrg * Software is furnished to do so, subject to the following conditions: 1217ca54c3Smrg * 1317ca54c3Smrg * The above copyright notice and this permission notice shall be included in 1417ca54c3Smrg * all copies or substantial portions of the Software. 1517ca54c3Smrg * 1617ca54c3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1717ca54c3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1817ca54c3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1917ca54c3Smrg * AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2017ca54c3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 2117ca54c3Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 2217ca54c3Smrg * DEALINGS IN THE SOFTWARE. 2317ca54c3Smrg * 2417ca54c3Smrg * Author: Thomas Hellström, 2004. 2517ca54c3Smrg */ 2617ca54c3Smrg 2717ca54c3Smrg 2817ca54c3Smrg#ifndef _VLDXVMC_H 2917ca54c3Smrg#define _VLDXVMC_H 3017ca54c3Smrg 3117ca54c3Smrg#include <X11/Xlib.h> 3217ca54c3Smrg#include <X11/extensions/XvMC.h> 3317ca54c3Smrg 3417ca54c3Smrg/* 3517ca54c3Smrg * New "Motion compensation type". 3617ca54c3Smrg */ 3717ca54c3Smrg 3817ca54c3Smrg#define XVMC_VLD 0x0020000 3917ca54c3Smrg 4017ca54c3Smrg/* 4117ca54c3Smrg * Below Flags to be passed in the XvMCMpegControl structure 'flag' field. 4217ca54c3Smrg */ 4317ca54c3Smrg 4417ca54c3Smrg#define XVMC_PROGRESSIVE_SEQUENCE 0x00000010 4517ca54c3Smrg 4617ca54c3Smrg/* 4717ca54c3Smrg * Zig-Zag Scan / Alternative Scan. 4817ca54c3Smrg */ 4917ca54c3Smrg 5017ca54c3Smrg#define XVMC_ZIG_ZAG_SCAN 0x00000000 5117ca54c3Smrg#define XVMC_ALTERNATE_SCAN 0x00000100 5217ca54c3Smrg 5317ca54c3Smrg/* 5417ca54c3Smrg * Frame DCT and frame prediction are used. / 5517ca54c3Smrg * Field prediction 5617ca54c3Smrg */ 5717ca54c3Smrg 5817ca54c3Smrg#define XVMC_PRED_DCT_FRAME 0x00000040 5917ca54c3Smrg#define XVMC_PRED_DCT_FIELD 0x00000000 6017ca54c3Smrg 6117ca54c3Smrg/* 6217ca54c3Smrg * Top / Bottom field first 6317ca54c3Smrg */ 6417ca54c3Smrg 6517ca54c3Smrg#define XVMC_TOP_FIELD_FIRST 0x00000080 6617ca54c3Smrg#define XVMC_BOTTOM_FIELD_FIRST 0x00000000 6717ca54c3Smrg 6817ca54c3Smrg/* 6917ca54c3Smrg * Motion vectors coded in intra macroblocks 7017ca54c3Smrg */ 7117ca54c3Smrg 7217ca54c3Smrg#define XVMC_CONCEALMENT_MOTION_VECTORS 0x00000200 7317ca54c3Smrg 7417ca54c3Smrg/* 7517ca54c3Smrg * Which of two mappings between quantiser_scale_code 7617ca54c3Smrg * and quantiser_scale shall apply. 7717ca54c3Smrg */ 7817ca54c3Smrg 7917ca54c3Smrg#define XVMC_Q_SCALE_TYPE 0x00000400 8017ca54c3Smrg 8117ca54c3Smrg/* 8217ca54c3Smrg * Intra VLC Format: Bit = 0, Bit = 1 8317ca54c3Smrg * Intra blocks B-14 B-15 8417ca54c3Smrg * Non-intra blocks B-14 B-14 8517ca54c3Smrg */ 8617ca54c3Smrg#define XVMC_INTRA_VLC_FORMAT 0x00000800 8717ca54c3Smrg 8817ca54c3Smrg/* 8917ca54c3Smrg * Also XVMC_SECOND_FIELD should be set in flags if active. 9017ca54c3Smrg */ 9117ca54c3Smrg 9217ca54c3Smrg#define XVMC_I_PICTURE 1 9317ca54c3Smrg#define XVMC_P_PICTURE 2 9417ca54c3Smrg#define XVMC_B_PICTURE 3 9517ca54c3Smrg 9617ca54c3Smrgtypedef struct _XvMCMpegControl{ 9717ca54c3Smrg unsigned 9817ca54c3Smrg BVMV_range, /* Backward vertical motion vector range */ 9917ca54c3Smrg BHMV_range, /* Backward horizontal motion vector range */ 10017ca54c3Smrg FVMV_range, /* Forward vertical motion vector range */ 10117ca54c3Smrg FHMV_range, /* Forward horizontal motion vector range */ 10217ca54c3Smrg picture_structure, /* XVMC_TOP_FIELD, XVMC_BOTTOM_FIELD, 10317ca54c3Smrg * XVMC_FRAME_PICTURE 10417ca54c3Smrg */ 10517ca54c3Smrg intra_dc_precision, /* 0x00 - 0x03 corresponds to 8 to 11 bits prec. */ 10617ca54c3Smrg picture_coding_type,/* XVMC_X_PICTURE */ 10717ca54c3Smrg mpeg_coding, /* XVMC_MPEG_2 */ 10817ca54c3Smrg flags; /* See above */ 10917ca54c3Smrg}XvMCMpegControl; 11017ca54c3Smrg 11117ca54c3Smrg 11217ca54c3Smrg/* 11317ca54c3Smrg * The following function is called BEFORE starting sending slices to the 11417ca54c3Smrg * lib. It grabs the decoder hardware and prepares it for coming slices. 11517ca54c3Smrg * The function XvMCSyncSurface will release the hardware for other contexts 11617ca54c3Smrg * in addition to it's current functionality. 11717ca54c3Smrg */ 11817ca54c3Smrg 11917ca54c3Smrgextern Status XvMCBeginSurface(Display *display, 12017ca54c3Smrg XvMCContext *context, 12117ca54c3Smrg XvMCSurface *target_surface, 12217ca54c3Smrg XvMCSurface *past_surface, 12317ca54c3Smrg XvMCSurface *future_surface, 12417ca54c3Smrg const XvMCMpegControl *control); 12517ca54c3Smrg 12617ca54c3Smrg 12717ca54c3Smrg/* 12817ca54c3Smrg * The quantizer matrix structure. This should be filled in by the user and 12917ca54c3Smrg * uploaded whenever a change is needed. The lib initializes with 13017ca54c3Smrg * default matrices and will automatically load the hardware with new matrices 13117ca54c3Smrg * on decoder context switches. To load data, set the corresponding load flag 13217ca54c3Smrg * to true and fill in the values. The VIA MPEG2 engine only uses the 13317ca54c3Smrg * intra_quantiser_matrix and the non_intra_quantiser_matrix. 13417ca54c3Smrg */ 13517ca54c3Smrg 13617ca54c3Smrgtypedef struct _XvMCQMatrix { 13717ca54c3Smrg int load_intra_quantiser_matrix; 13817ca54c3Smrg int load_non_intra_quantiser_matrix; 13917ca54c3Smrg int load_chroma_intra_quantiser_matrix; 14017ca54c3Smrg int load_chroma_non_intra_quantiser_matrix; 14117ca54c3Smrg unsigned char intra_quantiser_matrix[64]; 14217ca54c3Smrg unsigned char non_intra_quantiser_matrix[64]; 14317ca54c3Smrg unsigned char chroma_intra_quantiser_matrix[64]; 14417ca54c3Smrg unsigned char chroma_non_intra_quantiser_matrix[64]; 14517ca54c3Smrg} XvMCQMatrix; 14617ca54c3Smrg 14717ca54c3Smrg/* 14817ca54c3Smrg * Upload a XvMCQMatrix structure to the clientlib. 14917ca54c3Smrg * The hardware will start using it the next XvMCBeginSurface. 15017ca54c3Smrg */ 15117ca54c3Smrg 15217ca54c3Smrgextern Status XvMCLoadQMatrix(Display *display, XvMCContext *context, 15317ca54c3Smrg const XvMCQMatrix *qmx); 15417ca54c3Smrg 15517ca54c3Smrg 15617ca54c3Smrg/* 15717ca54c3Smrg * Put a slice to the decoder. The hardware will start processing it 15817ca54c3Smrg * immediately. 15917ca54c3Smrg */ 16017ca54c3Smrg 16117ca54c3Smrgextern Status XvMCPutSlice(Display *display,XvMCContext *context, 16217ca54c3Smrg char *slice, int nBytes); 16317ca54c3Smrg/* 16417ca54c3Smrg * Put a slice without the slice start code to the decoder. 16517ca54c3Smrg * The hardware will start processing it 16617ca54c3Smrg * immediately. This function is for client optimization. 16717ca54c3Smrg * XvMCPutSlice(display,context,slice,nBytes) is equivalent to 16817ca54c3Smrg * XvMCPutSlice2(display,context,slice+4,nBytes-4,slice[3]); 16917ca54c3Smrg */ 17017ca54c3Smrg 17117ca54c3Smrgextern Status XvMCPutSlice2(Display *display,XvMCContext *context, 17217ca54c3Smrg char *slice, int nBytes, int sliceCode); 17317ca54c3Smrg 17417ca54c3Smrg#endif 175