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