Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Common - Base - Type [Structs].h
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, Andrew Aye.  All Rights Reserved.
    This software is free for non-commercial use.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
      following conditions are met:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution in binary form must reproduce this copyright notice, this list of conditions and the following disclaimers in the documentation and other materials
          provided with the distribution.
    The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
    The intellectual property rights of the algorithms used reside with Andrew Aye.
    You may not use this software, in whole or in part, in support of any commercial product without the express written consent of the author.
    There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
#if !defined(TGS_COMMON_BASE_TYPES_STRUCTS_H)
#define TGS_COMMON_BASE_TYPES_STRUCTS_H
#pragma once


/* == Common ============================================================================================================================================================ */

/* ---- STg1_Codec ------------------------------------------------------------------------------------------------------------------------------------------------------ */

/*                                   Output,    Output Size, Input,      Input Size */
typedef TgBOOL(*TsCM_CD_FCN_ENCODE)( PC_TgVOID, PC_TgSIZE,   CPC_TgVOID, C_TgSIZE );
typedef TgBOOL(*TsCM_CD_FCN_DECODE)( PC_TgVOID, PC_TgSIZE,   CPC_TgVOID, C_TgSIZE );

TgTYPE_STRUCT(STg1_Codec,)
{
    TsCM_CD_FCN_ENCODE                          m_pfnEncode;
    TsCM_CD_FCN_DECODE                          m_pfnDecode;
};


TgINLINE TgVOID                             tgCM_CD_Init( PCU_STg1_Codec, TsCM_CD_FCN_ENCODE, TsCM_CD_FCN_DECODE );

TgINLINE TgBOOL                             tgCM_CD_EQ( CPCU_STg1_Codec, CPCU_STg1_Codec );
TgINLINE TgBOOL                             tgCM_CD_NE( CPCU_STg1_Codec, CPCU_STg1_Codec );
TgINLINE TgVOID                             tgCM_CD_Clear( PCU_STg1_Codec );
TgINLINE TgBOOL                             tgCM_CD_Is_Empty( CPCU_STg1_Codec );

TgINLINE TgBOOL                             tgCM_CD_NULL_ENCODE( PC_TgVOID, PC_TgSIZE, CPC_TgVOID, C_TgSIZE );
TgINLINE TgBOOL                             tgCM_CD_NULL_DECODE( PC_TgVOID, PC_TgSIZE, CPC_TgVOID, C_TgSIZE );
TgINLINE TgBOOL                             tgCM_CD_TEXT_ENCODE( PC_TgVOID, PC_TgSIZE, CPC_TgVOID, C_TgSIZE );
TgINLINE TgBOOL                             tgCM_CD_TEXT_DECODE( PC_TgVOID, PC_TgSIZE, CPC_TgVOID, C_TgSIZE );


/* ---- TgFCOLOUR ------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*# NOTE: All colours should also be matched with a color space enumeration */

TgINLINE TgVOID                             tgCM_CL_F32_Init_F32( PCU_TgVEC_F32_04, C_TgFLOAT32, C_TgFLOAT32, C_TgFLOAT32, C_TgFLOAT32 );
TgINLINE TgVOID                             tgCM_CL_F32_Init_U32( PCU_TgVEC_F32_04, C_TgUINT32 );

TgINLINE TgUINT16                           tgCM_CL_F32_Brightness_U16( CPCU_TgVEC_F32_04 );
TgINLINE TgFLOAT32                          tgCM_CL_F32_Brightness_F32( CPCU_TgVEC_F32_04 );
TgINLINE TgFLOAT32                          tgCM_CL_F32_Lightness( CPCU_TgVEC_F32_04 );
TgINLINE TgFLOAT32                          tgCM_CL_F32_Luminance( CPCU_TgVEC_F32_04 );

TgINLINE TgFLOAT32                          tgCM_CL_F32_Query_R_F32( CPCU_TgVEC_F32_04 );
TgINLINE TgFLOAT32                          tgCM_CL_F32_Query_G_F32( CPCU_TgVEC_F32_04 );
TgINLINE TgFLOAT32                          tgCM_CL_F32_Query_B_F32( CPCU_TgVEC_F32_04 );
TgINLINE TgFLOAT32                          tgCM_CL_F32_Query_A_F32( CPCU_TgVEC_F32_04 );

TgEXTN TgALIGN(16) C_TgVEC_F32_04           KTg_BLACK_709_F32_04;
TgEXTN TgALIGN(16) C_TgVEC_F32_04           KTg_WHITE_709_F32_04;
TgEXTN TgALIGN(16) C_TgVEC_F32_04           KTg_RED_709_F32_04;
TgEXTN TgALIGN(16) C_TgVEC_F32_04           KTg_GREEN_709_F32_04;
TgEXTN TgALIGN(16) C_TgVEC_F32_04           KTg_BLUE_709_F32_04;
TgEXTN TgALIGN(16) C_TgVEC_F32_04           KTg_YELLOW_709_F32_04;
TgEXTN TgALIGN(16) C_TgVEC_F32_04           KTg_MAGENTA_709_F32_04;
TgEXTN TgALIGN(16) C_TgVEC_F32_04           KTg_CYAN_709_F32_04;


/* ---- TgCOLOUR32 ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/*# NOTE: All colours should also be matched with a color space enumeration */

TgINLINE TgVOID                             tgCM_CL_U32_Init_U08( PCU_TgCOLOUR32, C_TgUINT08, C_TgUINT08, C_TgUINT08, C_TgUINT08 );
TgINLINE TgVOID                             tgCM_CL_U32_Init_U32( PCU_TgCOLOUR32, C_TgUINT32 );
TgINLINE TgVOID                             tgCM_CL_U32_Init_F32( PCU_TgCOLOUR32, CPCU_TgVEC_F32_04 );

TgINLINE TgUINT16                           tgCM_CL_U32_Brightness_U16( CPCU_TgCOLOUR32 );
TgINLINE TgFLOAT32                          tgCM_CL_U32_Brightness_F32( CPCU_TgCOLOUR32 );
TgINLINE TgFLOAT32                          tgCM_CL_U32_Lightness( CPCU_TgCOLOUR32 );
TgINLINE TgFLOAT32                          tgCM_CL_U32_Luminance( CPCU_TgCOLOUR32 );

TgINLINE TgUINT08                           tgCM_CL_U32_Query_R_U32( CPCU_TgCOLOUR32 );
TgINLINE TgUINT08                           tgCM_CL_U32_Query_G_U32( CPCU_TgCOLOUR32 );
TgINLINE TgUINT08                           tgCM_CL_U32_Query_B_U32( CPCU_TgCOLOUR32 );
TgINLINE TgUINT08                           tgCM_CL_U32_Query_A_U32( CPCU_TgCOLOUR32 );

TgINLINE TgFLOAT32                          tgCM_CL_U32_Query_R_F32( CPCU_TgCOLOUR32 );
TgINLINE TgFLOAT32                          tgCM_CL_U32_Query_G_F32( CPCU_TgCOLOUR32 );
TgINLINE TgFLOAT32                          tgCM_CL_U32_Query_B_F32( CPCU_TgCOLOUR32 );
TgINLINE TgFLOAT32                          tgCM_CL_U32_Query_A_F32( CPCU_TgCOLOUR32 );

TgEXTN TgALIGN(16) C_TgCOLOUR32             KTg_BLACK_709_U32;
TgEXTN TgALIGN(16) C_TgCOLOUR32             KTg_WHITE_709_U32;
TgEXTN TgALIGN(16) C_TgCOLOUR32             KTg_RED_709_U32;
TgEXTN TgALIGN(16) C_TgCOLOUR32             KTg_GREEN_709_U32;
TgEXTN TgALIGN(16) C_TgCOLOUR32             KTg_BLUE_709_U32;
TgEXTN TgALIGN(16) C_TgCOLOUR32             KTg_YELLOW_709_U32;
TgEXTN TgALIGN(16) C_TgCOLOUR32             KTg_MAGENTA_709_U32;
TgEXTN TgALIGN(16) C_TgCOLOUR32             KTg_CYAN_709_U32;


/* ====================================================================================================================================================================== */
#endif