summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/m4v_h263/dec/include
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2009-12-15 16:26:55 -0800
committerJames Dong <jdong@google.com>2009-12-17 12:53:03 -0800
commit3306cfee3bf38ab207a0504e49c2d492bb73ffbf (patch)
treeb68a76349710c58af816476c3cb8dcfda4f7bc49 /media/libstagefright/codecs/m4v_h263/dec/include
parent134ee6a324c35f39e3576172e4eae4c6de6eb9dc (diff)
downloadframeworks_av-3306cfee3bf38ab207a0504e49c2d492bb73ffbf.zip
frameworks_av-3306cfee3bf38ab207a0504e49c2d492bb73ffbf.tar.gz
frameworks_av-3306cfee3bf38ab207a0504e49c2d492bb73ffbf.tar.bz2
Initial checkins of the mpeg4 and h263 software decoders based on PV
Diffstat (limited to 'media/libstagefright/codecs/m4v_h263/dec/include')
-rw-r--r--media/libstagefright/codecs/m4v_h263/dec/include/m4vh263_decoder_pv_types.h66
-rw-r--r--media/libstagefright/codecs/m4v_h263/dec/include/mp4dec_api.h180
-rw-r--r--media/libstagefright/codecs/m4v_h263/dec/include/visual_header.h51
3 files changed, 297 insertions, 0 deletions
diff --git a/media/libstagefright/codecs/m4v_h263/dec/include/m4vh263_decoder_pv_types.h b/media/libstagefright/codecs/m4v_h263/dec/include/m4vh263_decoder_pv_types.h
new file mode 100644
index 0000000..e427b64
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/dec/include/m4vh263_decoder_pv_types.h
@@ -0,0 +1,66 @@
+/* ------------------------------------------------------------------
+ * 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 M4V_H263_DECODER_PV_TYPES_H_
+#define M4V_H263_DECODER_PV_TYPES_H_
+
+#include <stdint.h>
+#include <string.h>
+
+// Redefine the int types
+typedef uint8_t uint8;
+typedef uint16_t uint16;
+typedef int16_t int16;
+typedef uint32_t uint32;
+typedef int32_t int32;
+typedef unsigned int uint;
+
+// Redefine the oscl memory management routines
+#define oscl_memcpy memcpy
+#define oscl_memset memset
+#define oscl_malloc malloc
+#define oscl_free free
+#define oscl_memcmp memcmp
+#define OSCL_DELETE(ptr) { delete(ptr); }
+
+// Request status values. These are negative so that
+// they won't conflict with system error codes.
+const int32 OSCL_REQUEST_ERR_NONE = 0;
+const int32 OSCL_REQUEST_PENDING = (-0x7fffffff);
+const int32 OSCL_REQUEST_ERR_CANCEL = (-1);
+const int32 OSCL_REQUEST_ERR_GENERAL = (-2);
+
+// Request status type
+class OsclAOStatus
+{
+ public:
+ OsclAOStatus();
+ OsclAOStatus(int32 aStatus);
+ int32 operator=(int32 aStatus);
+ int32 operator==(int32 aStatus) const;
+ int32 operator!=(int32 aStatus) const;
+ int32 operator>=(int32 aStatus) const;
+ int32 operator<=(int32 aStatus) const;
+ int32 operator>(int32 aStatus) const;
+ int32 operator<(int32 aStatus) const;
+ int32 Value() const;
+ private:
+ int32 iStatus;
+};
+
+#endif // M4V_H263_DECODER_PV_TYPES_H_
diff --git a/media/libstagefright/codecs/m4v_h263/dec/include/mp4dec_api.h b/media/libstagefright/codecs/m4v_h263/dec/include/mp4dec_api.h
new file mode 100644
index 0000000..ef09900
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/dec/include/mp4dec_api.h
@@ -0,0 +1,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_ */
+
diff --git a/media/libstagefright/codecs/m4v_h263/dec/include/visual_header.h b/media/libstagefright/codecs/m4v_h263/dec/include/visual_header.h
new file mode 100644
index 0000000..48da0dc
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/dec/include/visual_header.h
@@ -0,0 +1,51 @@
+/* ------------------------------------------------------------------
+ * 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 _VISUAL_HEADER_H
+#define _VISUAL_HEADER_H
+
+#ifndef _PV_TYPES_ // In order to compile in MDF wrapper
+#define _PV_TYPES_
+
+#include "m4vh263_decoder_pv_types.h"
+
+typedef uint Bool;
+
+#endif // #ifndef _PV_TYPES_
+
+
+typedef struct tagVolInfo
+{
+ int32 shortVideoHeader; /* shortVideoHeader mode */
+
+ /* Error Resilience Flags */
+ int32 errorResDisable; /* VOL disable error resilence mode(Use Resynch markers) */
+ int32 useReverseVLC; /* VOL reversible VLCs */
+ int32 dataPartitioning; /* VOL data partitioning */
+
+ /* Parameters used for scalability */
+ int32 scalability; /* VOL scalability (flag) */
+
+ int32 nbitsTimeIncRes; /* number of bits for time increment () */
+
+ int32 profile_level_id; /* profile and level */
+
+
+} VolInfo;
+
+#endif // #ifndef _VISUAL_HEADER_H
+