1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
#ifndef _MP4DEC_API_H_
#define _MP4DEC_API_H_
#include "m4vh263_decoder_pv_types.h"
#define PV_TOLERATE_VOL_ERRORS
#define PV_MEMORY_POOL
#ifndef _PV_TYPES_
#define _PV_TYPES_
typedef uint Bool;
#define PV_CODEC_INIT 0
#define PV_CODEC_STOP 1
#endif
#define PV_TRUE 1
#define PV_FALSE 0
/* flag for post-processing 4/25/00 */
#ifdef DEC_NOPOSTPROC
#undef PV_POSTPROC_ON /* enable compilation of post-processing code */
#else
#define PV_POSTPROC_ON
#endif
#define PV_NO_POST_PROC 0
#define PV_DEBLOCK 1
#define PV_DERING 2
#include "visual_header.h" // struct VolInfo is defined
/**@name Structure and Data Types
* These type definitions specify the input / output from the PVMessage
* library.
*/
/*@{*/
/* The application has to allocate space for this structure */
typedef struct tagOutputFrame
{
uint8 *data; /* pointer to output YUV buffer */
uint32 timeStamp; /* time stamp */
} OutputFrame;
typedef struct tagApplicationData
{
int layer; /* current video layer */
void *object; /* some optional data field */
} applicationData;
/* Application controls, this structed shall be allocated */
/* and initialized in the application. */
typedef struct tagvideoDecControls
{
/* The following fucntion pointer is copied to BitstreamDecVideo structure */
/* upon initialization and never used again. */
int (*readBitstreamData)(uint8 *buf, int nbytes_required, void *appData);
applicationData appData;
uint8 *outputFrame;
void *videoDecoderData; /* this is an internal pointer that is only used */
/* in the decoder library. */
#ifdef PV_MEMORY_POOL
int32 size;
#endif
int nLayers;
/* pointers to VOL data for frame-based decoding. */
uint8 *volbuf[2]; /* maximum of 2 layers for now */
int32 volbuf_size[2];
} VideoDecControls;
typedef enum
{
H263_MODE = 0, MPEG4_MODE, UNKNOWN_MODE
} MP4DecodingMode;
typedef enum
{
MP4_I_FRAME, MP4_P_FRAME, MP4_B_FRAME, MP4_BAD_FRAME
} MP4FrameType;
typedef struct tagVopHeaderInfo
{
int currLayer;
uint32 timestamp;
MP4FrameType frameType;
int refSelCode;
int16 quantizer;
} VopHeaderInfo;
/*--------------------------------------------------------------------------*
* VideoRefCopyInfo:
* OMAP DSP specific typedef structure, to support the user (ARM) copying
* of a Reference Frame into the Video Decoder.
*--------------------------------------------------------------------------*/
typedef struct tagVideoRefCopyInfoPtr
{
uint8 *yChan; /* The Y component frame the user can copy a new reference to */
uint8 *uChan; /* The U component frame the user can copy a new reference to */
uint8 *vChan; /* The V component frame the user can copy a new reference to */
uint8 *currentVop; /* The Vop for video the user can copy a new reference to */
} VideoRefCopyInfoPtr;
typedef struct tagVideoRefCopyInfoData
{
int16 width; /* Width */
int16 height; /* Height */
int16 realWidth; /* Non-padded width, not a multiple of 16. */
int16 realHeight; /* Non-padded height, not a multiple of 16. */
} VideoRefCopyInfoData;
typedef struct tagVideoRefCopyInfo
{
VideoRefCopyInfoData data;
VideoRefCopyInfoPtr ptrs;
} VideoRefCopyInfo;
/*@}*/
#ifdef __cplusplus
extern "C"
{
#endif
OSCL_IMPORT_REF Bool PVInitVideoDecoder(VideoDecControls *decCtrl, uint8 *volbuf[], int32 *volbuf_size, int nLayers, int width, int height, MP4DecodingMode mode);
Bool PVAllocVideoData(VideoDecControls *decCtrl, int width, int height, int nLayers);
OSCL_IMPORT_REF Bool PVCleanUpVideoDecoder(VideoDecControls *decCtrl);
Bool PVResetVideoDecoder(VideoDecControls *decCtrl);
OSCL_IMPORT_REF void PVSetReferenceYUV(VideoDecControls *decCtrl, uint8 *refYUV);
Bool PVDecSetReference(VideoDecControls *decCtrl, uint8 *refYUV, uint32 timestamp);
Bool PVDecSetEnhReference(VideoDecControls *decCtrl, uint8 *refYUV, uint32 timestamp);
OSCL_IMPORT_REF Bool PVDecodeVideoFrame(VideoDecControls *decCtrl, uint8 *bitstream[], uint32 *timestamp, int32 *buffer_size, uint use_ext_timestamp[], uint8* currYUV);
Bool PVDecodeVopHeader(VideoDecControls *decCtrl, uint8 *buffer[], uint32 timestamp[], int32 buffer_size[], VopHeaderInfo *header_info, uint use_ext_timestamp[], uint8 *currYUV);
Bool PVDecodeVopBody(VideoDecControls *decCtrl, int32 buffer_size[]);
void PVDecPostProcess(VideoDecControls *decCtrl, uint8 *outputYUV);
OSCL_IMPORT_REF void PVGetVideoDimensions(VideoDecControls *decCtrl, int32 *display_width, int32 *display_height);
OSCL_IMPORT_REF void PVSetPostProcType(VideoDecControls *decCtrl, int mode);
uint32 PVGetVideoTimeStamp(VideoDecControls *decoderControl);
int PVGetDecBitrate(VideoDecControls *decCtrl);
int PVGetDecFramerate(VideoDecControls *decCtrl);
uint8 *PVGetDecOutputFrame(VideoDecControls *decCtrl);
int PVGetLayerID(VideoDecControls *decCtrl);
int32 PVGetDecMemoryUsage(VideoDecControls *decCtrl);
OSCL_IMPORT_REF MP4DecodingMode PVGetDecBitstreamMode(VideoDecControls *decCtrl);
Bool PVExtractVolHeader(uint8 *video_buffer, uint8 *vol_header, int32 *vol_header_size);
int32 PVLocateFrameHeader(uint8 *video_buffer, int32 vop_size);
int32 PVLocateH263FrameHeader(uint8 *video_buffer, int32 vop_size);
Bool PVGetVolInfo(VideoDecControls *decCtrl, VolInfo *pVolInfo); // BX 6/24/04
Bool IsIntraFrame(VideoDecControls *decoderControl);
#ifdef __cplusplus
}
#endif
#endif /* _MP4DEC_API_H_ */
|