Files
mpc-hc/include/mpc_defines.h
2023-10-03 21:13:29 +02:00

80 lines
2.5 KiB
C

/*
* (C) 2016-2019 see Authors.txt
*
* This file is part of MPC-HC.
*
* MPC-HC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* MPC-HC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifndef __MPC_DEFINES_H__
#define __MPC_DEFINES_H__
#define KILOBYTE 1024
#define MEGABYTE 1048576
#define GIGABYTE 1073741824
#define INVALID_TIME INT64_MIN
#define GETU16(b) *(UINT16*)(b)
#define GETU32(b) *(UINT32*)(b)
#define GETU64(b) *(UINT64*)(b)
#ifndef FCC
#define FCC(ch4) ((((DWORD)(ch4) & 0xFF) << 24) | \
(((DWORD)(ch4) & 0xFF00) << 8) | \
(((DWORD)(ch4) & 0xFF0000) >> 8) | \
(((DWORD)(ch4) & 0xFF000000) >> 24))
#endif
#define SCALE64(a, b, c) (__int64)((double)(a) * (b) / (c)) // very fast, but it can give a small rounding error
#define ALIGN(x, a) __ALIGN_MASK(x,(decltype(x))(a)-1)
#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
#define SAFE_DELETE(p) { if (p) { delete (p); (p) = nullptr; } }
#define SAFE_DELETE_ARRAY(p) { if (p) { delete [] (p); (p) = nullptr; } }
#define PCIV_ATI 0x1002
#define PCIV_nVidia 0x10DE
#define PCIV_Intel 0x8086
#define PCIV_S3_Graphics 0x5333
// values from MFVideoTransferMatrix (Win10SDK)
#define VIDEOTRANSFERMATRIX_BT2020_10 4
#define VIDEOTRANSFERMATRIX_BT2020_12 5
// non-standard values
#define VIDEOTRANSFERMATRIX_FCC 6
#define VIDEOTRANSFERMATRIX_YCgCo 7
// values from MFVideoPrimaries (Win10SDK)
#define VIDEOPRIMARIES_BT2020 9
#define VIDEOPRIMARIES_XYZ 10
#define VIDEOPRIMARIES_DCI_P3 11
#define VIDEOPRIMARIES_ACES 12
// values from MFVideoTransferFunction (Win10SDK)
#define VIDEOTRANSFUNC_Log_100 9
#define VIDEOTRANSFUNC_Log_316 10
#define VIDEOTRANSFUNC_709_sym 11
#define VIDEOTRANSFUNC_2020_const 12
#define VIDEOTRANSFUNC_2020 13
#define VIDEOTRANSFUNC_26 14
#define VIDEOTRANSFUNC_2084 15
#define VIDEOTRANSFUNC_HLG 16
#define VIDEOTRANSFUNC_10_rel 17
#endif