source: svn/branches/kctv/newcon3bcm2_21bu/magnum/commonutils/avc/7552/bavc_vce.h

Last change on this file was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 11.3 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2012, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bavc_vce.h $
11 * $brcm_Revision: Hydra_Software_Devel/18 $
12 * $brcm_Date: 2/1/12 12:30p $
13 *
14 * [File Description:]
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/commonutils/avc/7038/bavc_vce.h $
19 *
20 * Hydra_Software_Devel/18   2/1/12 12:30p nilesh
21 * SW7425-2277: Added BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_EMPTY_FRAME to
22 * support frame gaps
23 *
24 * Hydra_Software_Devel/17   5/18/11 2:55p nilesh
25 * SW7425-387: Added VC1 metadata support
26 *
27 * Hydra_Software_Devel/16   4/13/11 4:29p nilesh
28 * SW7425-303: Commented video metadata mechanism.  Added
29 * BAVC_VideoMetadataType enum.
30 *
31 * Hydra_Software_Devel/15   4/12/11 4:22p nilesh
32 * SW7425-303,SW7425-329: Update comment indicating addresses in
33 * BAVC_CompressedBufferStatus are cached
34 *
35 * Hydra_Software_Devel/14   4/11/11 11:56a nilesh
36 * SW7425-75: Removed BAVC_VideoBufferDescriptor.stMetadata struct.  Added
37 * BAVC_CompressedBufferStatus.pMetadataBufferBaseAddress.
38 *
39 * Hydra_Software_Devel/13   4/8/11 1:58p nilesh
40 * SW7425-75: Removed stInfo from BAVC_VideoBufferStatus
41 *
42 * Hydra_Software_Devel/12   4/8/11 12:47p nilesh
43 * SW7425-75: Removed constant metadata to Buffer Info
44 *
45 * Hydra_Software_Devel/11   4/7/11 4:01p nilesh
46 * SW7425-75: Add support for video metadata (common)
47 *
48 * Hydra_Software_Devel/10   3/29/11 4:07p nilesh
49 * SW7425-74: Merge to mainline from mp4_mux_devel branch
50 *
51 * Hydra_Software_Devel/mp4_mux_devel/1   3/14/11 7:38p delkert
52 * SW7425-74: Add BAVC_VIDEOBUFFERDESCRIPTOR_FLAGS_DATA_UNIT_START and
53 * uiDataUnitType to BAVC_VideoBufferDescriptor to support video data
54 * unit indication (e.g. H.264 NALU)
55 *
56 * Hydra_Software_Devel/9   3/4/11 4:07p delkert
57 * SW7425-73: Move EOS Flag since it is not a field validity flag (there
58 * is no EOS field)
59 *
60 * Hydra_Software_Devel/8   2/8/11 12:35p nilesh
61 * SW7425-1: Added eProfile and eProfile fields to BAVC_VideoBufferInfo
62 * struct
63 *
64 * Hydra_Software_Devel/7   2/3/11 4:39p nilesh
65 * SW7425-38,SW7425-1: Removed bavc_enc.h
66 *
67 * Hydra_Software_Devel/6   2/1/11 4:57p nilesh
68 * SW7425-38,SW7425-1: Added protocol to encoder buffer status
69 *
70 * Hydra_Software_Devel/5   2/1/11 4:15p nilesh
71 * SW7425-1,SW7425-38: Combined common portions of audio/video compressed
72 * buffer descriptors
73 *
74 * Hydra_Software_Devel/4   11/18/10 4:08p nilesh
75 * SW7425-38: Added protocol to buffer descriptor.  Updated description of
76 * transmission parameters.  Added VC1 metadata to video buffer
77 * descriptor.
78 *
79 * Hydra_Software_Devel/3   11/16/10 1:49p nilesh
80 * SW7425-38: Updated "flag" defines
81 *
82 * Hydra_Software_Devel/2   10/19/10 1:17p nilesh
83 * SW7425-38: Changed uiOffset to unsigned
84 *
85 * Hydra_Software_Devel/1   10/11/10 3:00p hongtaoz
86 * SW7425-38: merged to mainline;
87 *
88 * Hydra_Software_Devel/SW7425-38/2   9/24/10 12:03p nilesh
89 * SW7425-38: Added transmission parameters
90 *
91 * Hydra_Software_Devel/SW7425-38/1   9/21/10 2:06p nilesh
92 * SW7425-38: Added A/V encoder common files
93 *
94 ***************************************************************************/
95
96#ifndef BAVC_VCE_H__
97#define BAVC_VCE_H__
98
99#ifdef __cplusplus
100extern "C" {
101#if 0
102}
103#endif
104#endif
105
106/*****************/
107/* COMMON FIELDS */
108/*****************/
109
110/* COMMON field validity flags */
111#define BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_ORIGINALPTS_VALID         0x00000001
112#define BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_PTS_VALID                 0x00000002
113#define BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_ESCR_VALID                0x00000004
114#define BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_TICKSPERBIT_VALID         0x00000008
115#define BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_SHR_VALID                 0x00000010
116/* Add more field validity flags here */
117
118/* COMMON indicator flags */
119#define BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_FRAME_START               0x00010000
120#define BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_EOS                       0x00020000
121#define BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_EMPTY_FRAME               0x00040000 /* PTS and ESCR are expected to be valid. LENGTH is expected to be 0. */
122
123/* Add more indicator flags ABOVE this line */
124#define BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_METADATA                  0x40000000
125#define BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_EXTENDED                  0x80000000
126
127typedef struct BAVC_CompressedBufferDescriptor
128{
129   uint32_t uiFlags;
130
131   /* Timestamp Parameters */
132   uint32_t uiOriginalPTS; /* 32-bit original PTS value (in 45 Khz or 27Mhz?) */
133   uint64_t uiPTS; /* 33-bit PTS value (in 90 Khz or 27Mhz?) */
134
135   /* Transmission Parameters */
136   uint32_t uiESCR; /* Expected mux transmission start time for the first bit of the data (in 27 Mhz) */
137
138   /* TicksPerBit and iSHR indicate the transmission speed for the data.  So, the total duration (in 27 Mhz)
139    * for the transmission of this buffer is:
140    *
141    * uiDeltaESCR = ( uiTicksPerBit * ( uiLength * 8 ) );
142    * if ( iSHR > 0 )
143    * {
144    *    uiDeltaESCR >>= iSHR;
145    * }
146    * else
147    * {
148    *    uiDeltaESCR <<= -iSHR;
149    * }
150    *
151    * And the *earliest* valid transmission start time for the next buffer is simply:
152    *
153    * uiNextESCR = uiESCR + uiDeltaESCR;
154    */
155   uint16_t uiTicksPerBit;
156   int16_t iSHR;
157
158   /* Buffer Parameters */
159   unsigned uiOffset; /* REQUIRED: offset of frame data from frame buffer base address (in bytes) */
160   size_t uiLength;   /* REQUIRED: 0 if fragment is empty, e.g. for EOS entry (in bytes) */
161} BAVC_CompressedBufferDescriptor;
162
163typedef struct BAVC_CompressedBufferStatus
164{
165      /* Note: The following are CACHED addresses.
166       *
167       * The encoder must guarantee cache coherence for the referenced data.
168       * The consumer must convert to uncached or offset as needed if the data will
169       * be consumed by HW.
170       */
171      const void *pFrameBufferBaseAddress; /* The cached address of the start of the CDB. */
172      const void *pMetadataBufferBaseAddress; /* The cached address of the start of the metadata */
173} BAVC_CompressedBufferStatus;
174
175/*************************/
176/* VIDEO SPECIFIC FIELDS */
177/*************************/
178
179/* VIDEO field validity flags */
180#define BAVC_VIDEOBUFFERDESCRIPTOR_FLAGS_DTS_VALID                 0x00000001
181
182/* VIDEO indicator flags */
183#define BAVC_VIDEOBUFFERDESCRIPTOR_FLAGS_RAP                       0x00010000
184/* indicates a video data unit (NALU, EBDU, etc) starts at the beginning of
185   this descriptor  - if this is set, then the uiDataUnitID field is valid also */
186#define BAVC_VIDEOBUFFERDESCRIPTOR_FLAGS_DATA_UNIT_START           0x00020000
187
188#define BAVC_VIDEOBUFFERDESCRIPTOR_FLAGS_EXTENDED                  0x80000000
189
190typedef struct BAVC_VideoBufferDescriptor
191{
192      BAVC_CompressedBufferDescriptor stCommon;
193      uint32_t uiVideoFlags;
194
195      /* Timestamp Parameters */
196      uint64_t uiDTS; /* 33-bit DTS value (in 90 Kh or 27Mhz?) */
197
198      /* Metadata */
199      uint8_t uiDataUnitType; /* The meaning of this field depends on the flags that are
200                               * set in stCommon.uiFlags or uiVideoFlags.
201                               * These flags are *mutually exclusive*.
202                               *
203                               * uiVideoFlags = BAVC_VIDEOBUFFERDESCRIPTOR_FLAGS_DATA_UNIT_START
204                               *  protocol-specific data unit identifier (e.g. for H.264, this is the NALU type)
205                               *
206                               * uiFlags = BAVC_COMPRESSEDBUFFERDESCRIPTOR_FLAGS_METADATA
207                               *  indicates the type of metadata that is contained in the buffer.
208                               *  See BAVC_VideoMetadataType enum for possible types and values
209                               */
210} BAVC_VideoBufferDescriptor;
211
212typedef struct BAVC_VideoBufferInfo
213{
214      BAVC_VideoCompressionStd eProtocol;
215      BAVC_VideoCompressionProfile eProfile;
216      BAVC_VideoCompressionLevel eLevel;
217} BAVC_VideoBufferInfo;
218
219typedef struct BAVC_VideoBufferStatus
220{
221      BAVC_CompressedBufferStatus stCommon;
222} BAVC_VideoBufferStatus;
223
224#define BAVC_VideoContextMap BAVC_XptContextMap
225
226/******************/
227/* VIDEO Metadata */
228/******************/
229#define BAVC_VIDEOMETADATADESCRIPTOR_FLAGS_BITRATE_VALID          0x00000001
230#define BAVC_VIDEOMETADATADESCRIPTOR_FLAGS_FRAMERATE_VALID        0x00000002
231#define BAVC_VIDEOMETADATADESCRIPTOR_FLAGS_DIMENSION_CODED_VALID  0x00000004
232#define BAVC_VIDEOMETADATADESCRIPTOR_FLAGS_BUFFERINFO_VALID       0x00000008
233#define BAVC_VIDEOMETADATADESCRIPTOR_FLAGS_PROTOCOL_DATA_VALID    0x00000010
234
235typedef enum BAVC_VideoMetadataType
236{
237   BAVC_VideoMetadataType_eCommon, /* BAVC_VideoMetadataDescriptor */
238
239   /* This enum cannot contain more than 256 entries because uiDataUnitType is defined as a uint8_t */
240   BAVC_VideoMetadataType_eMax
241} BAVC_VideoMetadataType;
242
243typedef struct BAVC_VideoMetadata_VC1
244{
245      /* Sequence Header A (VERT_SIZE and HORIZ_SIZE): See BAVC_VideoMetadataDescriptor.stDimension.coded */
246
247      /* Sequence Header B */
248      struct
249      {
250            /* For LEVEL: See BAVC_VideoMetadataDescriptor.stBufferInfo.eLevel */
251            bool bCBR; /* CBR */
252            uint32_t uiHRDBuffer; /* HRD_BUFFER (Only 24 bits are valid) */
253            /* For HRD_RATE: See BAVC_VideoMetadataDescriptor.stBitrate */
254            /* For FRAMERATE: See BAVC_VideoMetadataDescriptor.stFrameRate */
255      } sequenceHeaderB;
256
257      struct
258      {
259            /* For Profile: See BAVC_VideoMetadataDescriptor.stBufferInfo.eProfile */
260            uint8_t uiQuantizedFrameRatePostProcessing; /* FRMRTQ_POSTPROC (Only 3 bits are valid) */
261            uint8_t uiQuantizedBitratePostProcessing; /* BITRTQ_POSTPROC (Only 5 bits are valid) */
262            bool bLoopFilter; /* LOOPFILTER */
263            bool bMultiResolution; /* MULTIRES */
264            bool bFastUVMotionCompensation; /* FASTUVMC */
265            bool bExtendedMotionVector; /* EXTENDED_MV */
266            uint8_t uiMacroblockQuantization; /* DQUANT (Only 2 bits are valid) */
267            bool bVariableSizedTransform; /* VSTRANSFORM */
268            bool bOverlappedTransform; /* OVERLAP */
269            bool bSyncMarker; /* SYNCMARKER */
270            bool bRangeReduction; /* RANGERED */
271            uint8_t uiMaxBFrames; /* MAXBFRAMES (Only 3 bits are valid) */
272            uint8_t uiQuantizer; /* QUANTIZER (Only 2 bits are valid) */
273            bool bFrameInterpolation; /* FINTERPFLAG */
274      } sequenceHeaderC;
275} BAVC_VideoMetadata_VC1;
276
277typedef struct BAVC_VideoMetadataDescriptor
278{
279      uint32_t uiMetadataFlags;
280
281      BAVC_VideoBufferInfo stBufferInfo;
282
283      struct
284      {
285            uint32_t uiMax; /* in bits/sec */
286      } stBitrate;
287
288      struct
289      {
290            BAVC_FrameRateCode eFrameRateCode;
291      } stFrameRate;
292
293      struct
294      {
295            struct
296            {
297                  uint16_t uiWidth;
298                  uint16_t uiHeight;
299            } coded;
300      } stDimension;
301
302      union
303      {
304            BAVC_VideoMetadata_VC1 stVC1; /* Applies for BAVC_VideoCompressionStd_eVC1SimpleMain */
305      } uProtocolData;
306
307} BAVC_VideoMetadataDescriptor;
308
309#ifdef __cplusplus
310}
311#endif
312
313#endif /* BAVC_VCE_H__ */
Note: See TracBrowser for help on using the repository browser.