/*
 * @Author: Jacky
 * @Date: 2024-06-19 10:37:58
 * @LastEditors: Jacky
 * @LastEditTime: 2024-09-27 11:17:29
 * @FilePath: /GeneralTracker/Adaptation/PlatformDefine.h
 */
#ifndef _PLATFORM_DEFINE_H_
#define _PLATFORM_DEFINE_H_

typedef enum _gd_pixel_format_e
{
    GD_PIXEL_FORMAT_NONE = 0,
    GD_PIXEL_FORMAT_YUV420P,
    GD_PIXEL_FORMAT_YUV422P,
    GD_PIXEL_FORMAT_NV12,
    GD_PIXEL_FORMAT_NV21,
    GD_PIXEL_FORMAT_NV16,
    GD_PIXEL_FORMAT_NV61,
    GD_PIXEL_FORMAT_RGB_PLANAR,
    GD_PIXEL_FORMAT_BGR_PLANAR,
    GD_PIXEL_FORMAT_RGB_PACKED,
    GD_PIXEL_FORMAT_BGR_PACKED,
    GD_PIXEL_FORMAT_GRAY_Y8,
    GD_PIXEL_FORMAT_GRAY_Y16,
    GD_PIXEL_FORMAT_GRAY_Y16Y8,
    GD_PIXEL_FORMAT_BUTT
} GD_PIXEL_FORMAT_E;

typedef struct _gd_video_frame_s
{
    unsigned int u32Width;
    unsigned int u32Height;
    GD_PIXEL_FORMAT_E enPixelFormat;
    unsigned int u32Stride[3];
    unsigned long long u64PhyAddr[3];
    unsigned char* u64VirAddr[3];
    unsigned int u32TimeRef;
    unsigned int u32FrameCnt;
    void*        private_data;
    void*        param_data;
} GD_VIDEO_FRAME_S;

inline float fixelBite(GD_PIXEL_FORMAT_E format){
    float val = 1.0;
    switch (format)
    {
    case GD_PIXEL_FORMAT_YUV420P:
    case GD_PIXEL_FORMAT_NV12:
    case GD_PIXEL_FORMAT_NV21:
        val = 1.5;
        break;
    case GD_PIXEL_FORMAT_YUV422P:
    case GD_PIXEL_FORMAT_GRAY_Y16:
        val = 2.0;
        break;
    case GD_PIXEL_FORMAT_RGB_PLANAR:
    case GD_PIXEL_FORMAT_BGR_PLANAR:
    case GD_PIXEL_FORMAT_RGB_PACKED:
    case GD_PIXEL_FORMAT_BGR_PACKED:
    	val = 1.0;
    	break;
    case GD_PIXEL_FORMAT_GRAY_Y16Y8:
        val = 3.0;
        break;
    case GD_PIXEL_FORMAT_GRAY_Y8:
        val = 1.0;
        break;
    default:
        break;
    }
    return val;
}



#endif