cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

h264.h (3957B)


      1/**
      2 * FreeRDP: A Remote Desktop Protocol Implementation
      3 * H.264 Bitmap Compression
      4 *
      5 * Copyright 2014 Mike McDonald <Mike.McDonald@software.dell.com>
      6 *
      7 * Licensed under the Apache License, Version 2.0 (the "License");
      8 * you may not use this file except in compliance with the License.
      9 * You may obtain a copy of the License at
     10 *
     11 *     http://www.apache.org/licenses/LICENSE-2.0
     12 *
     13 * Unless required by applicable law or agreed to in writing, software
     14 * distributed under the License is distributed on an "AS IS" BASIS,
     15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 * See the License for the specific language governing permissions and
     17 * limitations under the License.
     18 */
     19
     20#ifndef FREERDP_CODEC_H264_H
     21#define FREERDP_CODEC_H264_H
     22
     23#include <winpr/wlog.h>
     24
     25#include <freerdp/api.h>
     26#include <freerdp/types.h>
     27#include <freerdp/channels/rdpgfx.h>
     28
     29typedef struct _H264_CONTEXT H264_CONTEXT;
     30
     31typedef BOOL (*pfnH264SubsystemInit)(H264_CONTEXT* h264);
     32typedef void (*pfnH264SubsystemUninit)(H264_CONTEXT* h264);
     33
     34typedef int (*pfnH264SubsystemDecompress)(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSize);
     35typedef int (*pfnH264SubsystemCompress)(H264_CONTEXT* h264, const BYTE** pSrcYuv,
     36                                        const UINT32* pStride, BYTE** ppDstData, UINT32* pDstSize);
     37
     38struct _H264_CONTEXT_SUBSYSTEM
     39{
     40	const char* name;
     41	pfnH264SubsystemInit Init;
     42	pfnH264SubsystemUninit Uninit;
     43	pfnH264SubsystemDecompress Decompress;
     44	pfnH264SubsystemCompress Compress;
     45};
     46typedef struct _H264_CONTEXT_SUBSYSTEM H264_CONTEXT_SUBSYSTEM;
     47
     48enum _H264_RATECONTROL_MODE
     49{
     50	H264_RATECONTROL_VBR = 0,
     51	H264_RATECONTROL_CQP
     52};
     53typedef enum _H264_RATECONTROL_MODE H264_RATECONTROL_MODE;
     54
     55struct _H264_CONTEXT
     56{
     57	BOOL Compressor;
     58
     59	UINT32 width;
     60	UINT32 height;
     61
     62	H264_RATECONTROL_MODE RateControlMode;
     63	UINT32 BitRate;
     64	FLOAT FrameRate;
     65	UINT32 QP;
     66	UINT32 NumberOfThreads;
     67
     68	UINT32 iStride[3];
     69	BYTE* pYUVData[3];
     70
     71	UINT32 iYUV444Size[3];
     72	UINT32 iYUV444Stride[3];
     73	BYTE* pYUV444Data[3];
     74
     75	UINT32 numSystemData;
     76	void* pSystemData;
     77	H264_CONTEXT_SUBSYSTEM* subsystem;
     78
     79	void* lumaData;
     80	wLog* log;
     81};
     82#ifdef __cplusplus
     83extern "C"
     84{
     85#endif
     86
     87	FREERDP_API INT32 avc420_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat,
     88	                                  UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight,
     89	                                  BYTE** ppDstData, UINT32* pDstSize);
     90
     91	FREERDP_API INT32 avc420_decompress(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSize,
     92	                                    BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep,
     93	                                    UINT32 nDstWidth, UINT32 nDstHeight,
     94	                                    RECTANGLE_16* regionRects, UINT32 numRegionRect);
     95
     96	FREERDP_API INT32 avc444_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat,
     97	                                  UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight,
     98	                                  BYTE version, BYTE* op, BYTE** pDstData, UINT32* pDstSize,
     99	                                  BYTE** pAuxDstData, UINT32* pAuxDstSize);
    100
    101	FREERDP_API INT32 avc444_decompress(H264_CONTEXT* h264, BYTE op, RECTANGLE_16* regionRects,
    102	                                    UINT32 numRegionRect, const BYTE* pSrcData, UINT32 SrcSize,
    103	                                    RECTANGLE_16* auxRegionRects, UINT32 numAuxRegionRect,
    104	                                    const BYTE* pAuxSrcData, UINT32 AuxSrcSize, BYTE* pDstData,
    105	                                    DWORD DstFormat, UINT32 nDstStep, UINT32 nDstWidth,
    106	                                    UINT32 nDstHeight, UINT32 codecId);
    107
    108	FREERDP_API BOOL h264_context_reset(H264_CONTEXT* h264, UINT32 width, UINT32 height);
    109
    110	FREERDP_API H264_CONTEXT* h264_context_new(BOOL Compressor);
    111	FREERDP_API void h264_context_free(H264_CONTEXT* h264);
    112
    113#ifdef __cplusplus
    114}
    115#endif
    116
    117#endif /* FREERDP_CODEC_H264_H */