/*---------------------------------------------------------------------------* Copyright (C) Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ #ifndef _H264DECAPI_H #define _H264DECAPI_H #ifdef __cplusplus extern "C" { #endif /* set parameters */ #define H264DEC_PARAM_ID_FPTR_OUTPUT (0x00000001) #define H264DEC_PARAM_ID_OUTPUT_PER_FRAME (0x20000002) #define H264DEC_PARAM_ID_USER_MEMORY (0x70000001) #define BUFFERING_OUTPUT_PER_FRAME (0x00000000) #define UNBUFFERING_OUTPUT_PER_FRAME (0x00000001) /* alignment */ #define H264DEC_ALIGN_PITCH_IN_PIXELS(PitchInPixels) ((PitchInPixels + 0xFF) & ~0xFF) #define H264DEC_BUFFER_ALIGNMENT (256) /* Profile */ #define H264_BASELINE_PROFILE ( 66) #define H264_MAIN_PROFILE ( 77) #define H264_HIGH_PROFILE (100) /* 0x(01 XX 00 00) : stream error XX -> xxxx x000 (stream error ID[5bit]) 00000 : general 00001 : profile error (not supported) 00010 : no slice which can be decoded 00011 : not supported (ex. required resolution) ------------------------ 00100 - 11111 : reserved */ #define H264DEC_ERR_STREAM (0x01000000) #define H264DEC_ERR_PROFILE (0x01080000) #define H264DEC_ERR_NODATA (0x01100000) #define H264DEC_ERR_NOTSUPPORTED (0x01180000) #define H264DEC_ERR_PARAM (0x01010000) #define H264DEC_ERR_OUTOFMEMORY (0x01020000) #define H264DEC_ERR_INTERNAL (0x01030000) #define H264DEC_ERR_SEQUENCE (0x01050000) #define H264DEC_ERR_MEMSEGMENT (0x01060000) #define H264DEC_ERR_MAX_SIZE (0x01070000) #define H264DEC_ERR_BUFFEREMPTY (0x00080000) #define H264DEC_ERR_USE_FM (0x00000080) #define H264DEC_ERR_FM_STAT (0x000000FF) // VUI Parameters typedef struct __VUI_PARAMETERS__ { u8 aspect_ratio_info_present_flag; u8 aspect_ratio_idc; s16 sar_width; s16 sar_height; u8 overscan_info_present_flag; u8 overscan_appropriate_flag; u8 video_signal_type_present_flag; u8 video_format; u8 video_full_range_flag; u8 colour_description_present_flag; u8 colour_primaries; u8 transfer_characteristics; u8 matrix_coefficients; u8 chroma_loc_info_present_flag; u8 chroma_sample_loc_type_top_field; u8 chroma_sample_loc_type_bottom_field; u8 timing_info_present_flag; u32 num_units_in_tick; u32 time_scale; u8 fixed_frame_rate_flag; u8 nal_hrd_parameters_present_flag; u8 vcl_hrd_parameters_present_flag; u8 low_delay_hrd_flag; u8 pic_struct_present_flag; u8 bitstream_restriction_flag; u8 motion_vectors_over_pic_boundaries_flag; s16 max_bytes_per_pic_denom; s16 max_bits_per_mb_denom; s16 log2_max_mv_length_horizontal; s16 log2_max_mv_length_vertical; s16 num_reorder_frames; s16 max_dec_frame_buffering; } VUIParameters; typedef struct __H264DEC_RESULT__ { s32 DecStatus; f64 TimeStamp; s32 ResultWidth; s32 ResultHeight; s32 NextLine; u8 CropEnableFlag; s32 TopCrop; s32 BottomCrop; s32 LeftCrop; s32 RightCrop; u8 PanScanEnableFlag; s32 TopPanScan; s32 BottomPanScan; s32 LeftPanScan; s32 RightPanScan; void *Result; u8 vui_parameters_present_flag; VUIParameters *VUIparameters; s32 reserved[10]; } H264DECResult; typedef struct __H264DEC_OUTPUT__ { s32 FmCnt; H264DECResult **DecResPtr; void *UserMemory; } H264DECOutput; /* API */ s32 H264DECInitParam(s32 memSize, void *memPtr); s32 H264DECSetParam(void *memPtr, s32 paramid, void *param); s32 H264DECOpen(void *memPtr); s32 H264DECBegin(void *memPtr); s32 H264DECSetBitstream(void *memPtr, const u8 *bitstream, const s32 length, const f64 timeStamp); s32 H264DECExecute(void *memPtr, void *StrFmPtr ); s32 H264DECFlush(void *memPtr); s32 H264DECEnd(void *memPtr); s32 H264DECClose(void *memPtr); s32 H264DECMemoryRequirement(s32 Profile, s32 Level, s32 MaxWidth, s32 MaxHeight, s32 *CodecMemSize); s32 H264DECGetImageSize(const u8 *buf, s32 TotalBytes, s32 streamOffset, s32 *Width, s32 *Height); s32 H264DECFindDecstartpoint(const u8 *buf, s32 totalBytes, s32 *streamOffset); s32 H264DECFindIdrpoint(const u8 *buf, s32 totalBytes, s32 *streamOffset); s32 H264DECCheckDecunitLength(void *memPtr, const u8 *buf, s32 totalBytes, s32 streamOffset, s32 *length); s32 H264DECCheckMemSegmentation(void *memPtr, u32 Size); s32 H264DECCheckSkipableFrame(const u8 *buf, s32 Length, s32 *SkipFlag); /* not supported */ s32 H264DECSetParam_FPTR_OUTPUT(void *memPtr, int (*func)(void *)); s32 H264DECSetParam_OUTPUT_PER_FRAME(void *memPtr, int outputPerFrameFlag); s32 H264DECSetParam_USER_MEMORY(void *memPtr, void **usermem ); #ifdef __cplusplus } #endif #endif /* _H264API__H */