FreeRDP
h264.c File Reference
#include <freerdp/config.h>
#include <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/library.h>
#include <winpr/bitstream.h>
#include <winpr/synch.h>
#include <freerdp/primitives.h>
#include <freerdp/codec/h264.h>
#include <freerdp/codec/yuv.h>
#include <freerdp/log.h>
#include "h264.h"

Macros

#define TAG   FREERDP_TAG("codec")
 
#define MAX_SUBSYSTEMS   10
 

Functions

static BOOL avc444_ensure_buffer (H264_CONTEXT *h264, DWORD nDstHeight)
 
BOOL avc420_ensure_buffer (H264_CONTEXT *h264, UINT32 stride, UINT32 width, UINT32 height)
 
INT32 avc420_decompress (H264_CONTEXT *h264, const BYTE *pSrcData, UINT32 SrcSize, BYTE *pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nDstWidth, UINT32 nDstHeight, const RECTANGLE_16 *regionRects, UINT32 numRegionRects)
 
static BOOL allocate_h264_metablock (UINT32 QP, RECTANGLE_16 *rectangles, RDPGFX_H264_METABLOCK *meta, size_t count)
 
static INLINE BOOL diff_tile (const RECTANGLE_16 *regionRect, BYTE *pYUVData[3], BYTE *pOldYUVData[3], UINT32 const iStride[3])
 
static BOOL detect_changes (BOOL firstFrameDone, const UINT32 QP, const RECTANGLE_16 *regionRect, BYTE *pYUVData[3], BYTE *pOldYUVData[3], UINT32 const iStride[3], RDPGFX_H264_METABLOCK *meta)
 
INT32 h264_get_yuv_buffer (H264_CONTEXT *h264, UINT32 nSrcStride, UINT32 nSrcWidth, UINT32 nSrcHeight, BYTE *YUVData[3], UINT32 stride[3])
 
INT32 h264_compress (H264_CONTEXT *h264, BYTE **ppDstData, UINT32 *pDstSize)
 
INT32 avc420_compress (H264_CONTEXT *h264, const BYTE *pSrcData, DWORD SrcFormat, UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight, const RECTANGLE_16 *regionRect, BYTE **ppDstData, UINT32 *pDstSize, RDPGFX_H264_METABLOCK *meta)
 
INT32 avc444_compress (H264_CONTEXT *h264, const BYTE *pSrcData, DWORD SrcFormat, UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight, BYTE version, const RECTANGLE_16 *region, BYTE *op, BYTE **ppDstData, UINT32 *pDstSize, BYTE **ppAuxDstData, UINT32 *pAuxDstSize, RDPGFX_H264_METABLOCK *meta, RDPGFX_H264_METABLOCK *auxMeta)
 
static BOOL avc444_process_rects (H264_CONTEXT *h264, const BYTE *pSrcData, UINT32 SrcSize, BYTE *pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nDstWidth, UINT32 nDstHeight, const RECTANGLE_16 *rects, UINT32 nrRects, avc444_frame_type type)
 
INT32 avc444_decompress (H264_CONTEXT *h264, BYTE op, const RECTANGLE_16 *regionRects, UINT32 numRegionRects, const BYTE *pSrcData, UINT32 SrcSize, const RECTANGLE_16 *auxRegionRects, UINT32 numAuxRegionRect, const BYTE *pAuxSrcData, UINT32 AuxSrcSize, BYTE *pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nDstWidth, UINT32 nDstHeight, UINT32 codecId)
 
static BOOL CALLBACK h264_register_subsystems (PINIT_ONCE once, PVOID param, PVOID *context)
 
static BOOL h264_context_init (H264_CONTEXT *h264)
 
BOOL h264_context_reset (H264_CONTEXT *h264, UINT32 width, UINT32 height)
 
H264_CONTEXT * h264_context_new (BOOL Compressor)
 
void h264_context_free (H264_CONTEXT *h264)
 
void free_h264_metablock (RDPGFX_H264_METABLOCK *meta)
 
BOOL h264_context_set_option (H264_CONTEXT *h264, H264_CONTEXT_OPTION option, UINT32 value)
 
UINT32 h264_context_get_option (H264_CONTEXT *h264, H264_CONTEXT_OPTION option)
 

Variables

static INIT_ONCE subsystems_once = INIT_ONCE_STATIC_INIT
 
static const H264_CONTEXT_SUBSYSTEM * subSystems [MAX_SUBSYSTEMS] = { 0 }
 

Macro Definition Documentation

◆ MAX_SUBSYSTEMS

#define MAX_SUBSYSTEMS   10

◆ TAG

#define TAG   FREERDP_TAG("codec")

FreeRDP: A Remote Desktop Protocol Implementation H.264 Bitmap Compression

Copyright 2014 Mike McDonald Mike..nosp@m.McDo.nosp@m.nald@.nosp@m.soft.nosp@m.ware..nosp@m.dell.nosp@m..com Copyright 2017 David Fort conta.nosp@m.ct@h.nosp@m.arden.nosp@m.ing-.nosp@m.consu.nosp@m.ltin.nosp@m.g.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ allocate_h264_metablock()

static BOOL allocate_h264_metablock ( UINT32  QP,
RECTANGLE_16 rectangles,
RDPGFX_H264_METABLOCK meta,
size_t  count 
)
static
Here is the caller graph for this function:

◆ avc420_compress()

INT32 avc420_compress ( H264_CONTEXT *  h264,
const BYTE pSrcData,
DWORD  SrcFormat,
UINT32  nSrcStep,
UINT32  nSrcWidth,
UINT32  nSrcHeight,
const RECTANGLE_16 regionRect,
BYTE **  ppDstData,
UINT32 *  pDstSize,
RDPGFX_H264_METABLOCK meta 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ avc420_decompress()

INT32 avc420_decompress ( H264_CONTEXT *  h264,
const BYTE pSrcData,
UINT32  SrcSize,
BYTE pDstData,
DWORD  DstFormat,
UINT32  nDstStep,
UINT32  nDstWidth,
UINT32  nDstHeight,
const RECTANGLE_16 regionRects,
UINT32  numRegionRects 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ avc420_ensure_buffer()

BOOL avc420_ensure_buffer ( H264_CONTEXT *  h264,
UINT32  stride,
UINT32  width,
UINT32  height 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ avc444_compress()

INT32 avc444_compress ( H264_CONTEXT *  h264,
const BYTE pSrcData,
DWORD  SrcFormat,
UINT32  nSrcStep,
UINT32  nSrcWidth,
UINT32  nSrcHeight,
BYTE  version,
const RECTANGLE_16 region,
BYTE op,
BYTE **  ppDstData,
UINT32 *  pDstSize,
BYTE **  ppAuxDstData,
UINT32 *  pAuxDstSize,
RDPGFX_H264_METABLOCK meta,
RDPGFX_H264_METABLOCK auxMeta 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ avc444_decompress()

INT32 avc444_decompress ( H264_CONTEXT *  h264,
BYTE  op,
const RECTANGLE_16 regionRects,
UINT32  numRegionRects,
const BYTE pSrcData,
UINT32  SrcSize,
const RECTANGLE_16 auxRegionRects,
UINT32  numAuxRegionRect,
const BYTE pAuxSrcData,
UINT32  AuxSrcSize,
BYTE pDstData,
DWORD  DstFormat,
UINT32  nDstStep,
UINT32  nDstWidth,
UINT32  nDstHeight,
UINT32  codecId 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ avc444_ensure_buffer()

static BOOL avc444_ensure_buffer ( H264_CONTEXT *  h264,
DWORD  nDstHeight 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ avc444_process_rects()

static BOOL avc444_process_rects ( H264_CONTEXT *  h264,
const BYTE pSrcData,
UINT32  SrcSize,
BYTE pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nDstWidth,
UINT32  nDstHeight,
const RECTANGLE_16 rects,
UINT32  nrRects,
avc444_frame_type  type 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ detect_changes()

static BOOL detect_changes ( BOOL  firstFrameDone,
const UINT32  QP,
const RECTANGLE_16 regionRect,
BYTE pYUVData[3],
BYTE pOldYUVData[3],
UINT32 const  iStride[3],
RDPGFX_H264_METABLOCK meta 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ diff_tile()

static INLINE BOOL diff_tile ( const RECTANGLE_16 regionRect,
BYTE pYUVData[3],
BYTE pOldYUVData[3],
UINT32 const  iStride[3] 
)
static
Here is the caller graph for this function:

◆ free_h264_metablock()

void free_h264_metablock ( RDPGFX_H264_METABLOCK meta)
Here is the caller graph for this function:

◆ h264_compress()

INT32 h264_compress ( H264_CONTEXT *  h264,
BYTE **  ppDstData,
UINT32 *  pDstSize 
)

Function description

Returns
Here is the caller graph for this function:

◆ h264_context_free()

void h264_context_free ( H264_CONTEXT *  h264)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ h264_context_get_option()

UINT32 h264_context_get_option ( H264_CONTEXT *  h264,
H264_CONTEXT_OPTION  option 
)

◆ h264_context_init()

static BOOL h264_context_init ( H264_CONTEXT *  h264)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ h264_context_new()

H264_CONTEXT* h264_context_new ( BOOL  Compressor)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ h264_context_reset()

BOOL h264_context_reset ( H264_CONTEXT *  h264,
UINT32  width,
UINT32  height 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ h264_context_set_option()

BOOL h264_context_set_option ( H264_CONTEXT *  h264,
H264_CONTEXT_OPTION  option,
UINT32  value 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ h264_get_yuv_buffer()

INT32 h264_get_yuv_buffer ( H264_CONTEXT *  h264,
UINT32  nSrcStride,
UINT32  nSrcWidth,
UINT32  nSrcHeight,
BYTE YUVData[3],
UINT32  stride[3] 
)

Function description

Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ h264_register_subsystems()

static BOOL CALLBACK h264_register_subsystems ( PINIT_ONCE  once,
PVOID  param,
PVOID *  context 
)
static
Here is the caller graph for this function:

Variable Documentation

◆ subSystems

const H264_CONTEXT_SUBSYSTEM* subSystems[MAX_SUBSYSTEMS] = { 0 }
static

◆ subsystems_once

INIT_ONCE subsystems_once = INIT_ONCE_STATIC_INIT
static