21#include <freerdp/config.h>
24#include <winpr/print.h>
25#include <winpr/library.h>
26#include <winpr/bitstream.h>
27#include <winpr/synch.h>
29#include <freerdp/primitives.h>
30#include <freerdp/codec/h264.h>
31#include <freerdp/codec/yuv.h>
32#include <freerdp/log.h>
33#include <freerdp/codec/region.h>
37#define TAG FREERDP_TAG("codec")
40static BOOL avc444_ensure_buffer(H264_CONTEXT* h264, DWORD nDstHeight);
43static BOOL yuv_ensure_buffer(H264_CONTEXT* h264, UINT32 stride, UINT32 width, UINT32 height)
46 UINT32 pheight = height;
53 const UINT32 pad = width % 16;
60 stride += 32 - stride % 16;
61 pheight += 32 - pheight % 16;
63 const size_t nPlanes = h264->hwAccel ? 2 : 3;
65 for (
size_t x = 0; x < nPlanes; x++)
67 if (!h264->pYUVData[x] || !h264->pOldYUVData[x])
76 if (isNull || (width != h264->width) || (height != h264->height) ||
77 (stride != h264->iStride[0]))
81 h264->iStride[0] = stride;
82 h264->iStride[1] = stride;
87 h264->iStride[0] = stride;
88 h264->iStride[1] = (stride + 1) / 2;
89 h264->iStride[2] = (stride + 1) / 2;
92 for (
size_t x = 0; x < nPlanes; x++)
94 BYTE* tmp1 = winpr_aligned_recalloc(h264->pYUVData[x], h264->iStride[x], pheight, 16);
96 winpr_aligned_recalloc(h264->pOldYUVData[x], h264->iStride[x], pheight, 16);
98 h264->pYUVData[x] = tmp1;
100 h264->pOldYUVData[x] = tmp2;
105 h264->height = height;
111BOOL avc420_ensure_buffer(H264_CONTEXT* h264, UINT32 stride, UINT32 width, UINT32 height)
113 return yuv_ensure_buffer(h264, stride, width, height);
117static BOOL isRectValid(wLog* log,
size_t pos, UINT32 width, UINT32 height,
121 if ((rect->left > width) || (rect->right > width) || (rect->left >= rect->right) ||
122 (rect->top > height) || (rect->bottom > height) || (rect->top >= rect->bottom))
124 char buffer[64] = WINPR_C_ARRAY_INIT;
125 WLog_Print(log, WLOG_WARN,
126 "Rectangle %" PRIuz
" %s outside of bounding frame %" PRIu32
"x%" PRIu32, pos,
127 rectangle_to_string(rect, buffer,
sizeof(buffer)), width, height);
135static BOOL areRectsValid(wLog* log, UINT32 width, UINT32 height,
const RECTANGLE_16* rects,
138 WINPR_ASSERT(rects || (count == 0));
139 for (
size_t x = 0; x < count; x++)
142 if (!isRectValid(log, x, width, height, rect))
149static int log_decompress(H264_CONTEXT* h264,
const BYTE* pSrcData, UINT32 SrcSize,
153 WINPR_ASSERT(h264->subsystem);
154 WINPR_ASSERT(h264->subsystem->Decompress);
156 const int status = h264->subsystem->Decompress(h264, pSrcData, SrcSize);
159 WLog_Print(h264->log, WLOG_WARN,
"H264 decompress failed with %d", status);
169 if (!areRectsValid(h264->log, h264->YUVWidth, h264->YUVHeight, rects, nrRects))
171 if (!areRectsValid(h264->log, h264->width, h264->height, rects, nrRects))
176INT32 avc420_decompress(H264_CONTEXT* h264,
const BYTE* pSrcData, UINT32 SrcSize, BYTE* pDstData,
177 DWORD DstFormat, UINT32 nDstStep, WINPR_ATTR_UNUSED UINT32 nDstWidth,
178 WINPR_ATTR_UNUSED UINT32 nDstHeight,
const RECTANGLE_16* regionRects,
179 UINT32 numRegionRects)
182 const BYTE* pYUVData[3];
184 if (!h264 || h264->Compressor)
187 if (!areRectsValid(h264->log, nDstWidth, nDstHeight, regionRects, numRegionRects))
190 status = log_decompress(h264, pSrcData, SrcSize, regionRects, numRegionRects);
198 pYUVData[0] = h264->pYUVData[0];
199 pYUVData[1] = h264->pYUVData[1];
200 pYUVData[2] = h264->pYUVData[2];
201 if (!yuv420_context_decode(h264->yuv, pYUVData, h264->iStride, h264->YUVHeight, DstFormat,
202 pDstData, nDstStep, regionRects, numRegionRects))
209static BOOL allocate_h264_metablock(UINT32 QP,
RECTANGLE_16* rectangles,
213 if (!meta || (QP > UINT8_MAX))
219 meta->regionRects = rectangles;
223 if (count > UINT32_MAX)
228 if (!meta->quantQualityVals || !meta->regionRects)
230 meta->numRegionRects = (UINT32)count;
231 for (
size_t x = 0; x < count; x++)
238 cur->qualityVal = 100 - (QP & 0x3F);
244static inline BOOL diff_tile(
const RECTANGLE_16* regionRect, BYTE* pYUVData[3],
245 BYTE* pOldYUVData[3], UINT32
const iStride[3])
249 if (!regionRect || !pYUVData || !pOldYUVData || !iStride)
251 size = regionRect->right - regionRect->left;
252 if (regionRect->right > iStride[0])
254 if (regionRect->right / 2u > iStride[1])
256 if (regionRect->right / 2u > iStride[2])
259 for (
size_t y = regionRect->top; y < regionRect->bottom; y++)
261 const BYTE* cur0 = &pYUVData[0][y * iStride[0]];
262 const BYTE* cur1 = &pYUVData[1][y * iStride[1]];
263 const BYTE* cur2 = &pYUVData[2][y * iStride[2]];
264 const BYTE* old0 = &pOldYUVData[0][y * iStride[0]];
265 const BYTE* old1 = &pOldYUVData[1][y * iStride[1]];
266 const BYTE* old2 = &pOldYUVData[2][y * iStride[2]];
268 if (memcmp(&cur0[regionRect->left], &old0[regionRect->left], size) != 0)
270 if (memcmp(&cur1[regionRect->left / 2], &old1[regionRect->left / 2], size / 2) != 0)
272 if (memcmp(&cur2[regionRect->left / 2], &old2[regionRect->left / 2], size / 2) != 0)
279static BOOL detect_changes(BOOL firstFrameDone,
const UINT32 QP,
const RECTANGLE_16* regionRect,
280 BYTE* pYUVData[3], BYTE* pOldYUVData[3], UINT32
const iStride[3],
288 if (!regionRect || !pYUVData || !pOldYUVData || !iStride || !meta)
291 wc = (regionRect->right - regionRect->left) / 64 + 1;
292 hc = (regionRect->bottom - regionRect->top) / 64 + 1;
298 rectangles[0] = *regionRect;
303 for (
size_t y = 0; y < regionRect->bottom - regionRect->top; y += 64)
305 for (
size_t x = 0; x < regionRect->right - regionRect->left; x += 64)
308 rect.left = (UINT16)MIN(UINT16_MAX, regionRect->left + x);
309 rect.top = (UINT16)MIN(UINT16_MAX, regionRect->top + y);
311 (UINT16)MIN(UINT16_MAX, MIN(regionRect->left + x + 64, regionRect->right));
313 (UINT16)MIN(UINT16_MAX, MIN(regionRect->top + y + 64, regionRect->bottom));
314 if (diff_tile(&rect, pYUVData, pOldYUVData, iStride))
315 rectangles[count++] = rect;
319 if (!allocate_h264_metablock(QP, rectangles, meta, count))
324INT32 h264_get_yuv_buffer(H264_CONTEXT* h264, UINT32 nSrcStride, UINT32 nSrcWidth,
325 UINT32 nSrcHeight, BYTE* YUVData[3], UINT32 stride[3])
327 if (!h264 || !h264->Compressor || !h264->subsystem || !h264->subsystem->Compress)
330 if (!yuv_ensure_buffer(h264, nSrcStride, nSrcWidth, nSrcHeight))
333 for (
size_t x = 0; x < 3; x++)
335 YUVData[x] = h264->pYUVData[x];
336 stride[x] = h264->iStride[x];
342INT32 h264_compress(H264_CONTEXT* h264, BYTE** ppDstData, UINT32* pDstSize)
344 if (!h264 || !h264->Compressor || !h264->subsystem || !h264->subsystem->Compress)
347 const BYTE* pcYUVData[3] = { h264->pYUVData[0], h264->pYUVData[1], h264->pYUVData[2] };
349 return h264->subsystem->Compress(h264, pcYUVData, h264->iStride, ppDstData, pDstSize);
352INT32 avc420_compress(H264_CONTEXT* h264,
const BYTE* pSrcData, DWORD SrcFormat, UINT32 nSrcStep,
353 UINT32 nSrcWidth, UINT32 nSrcHeight,
const RECTANGLE_16* regionRect,
357 BYTE* pYUVData[3] = WINPR_C_ARRAY_INIT;
358 const BYTE* pcYUVData[3] = WINPR_C_ARRAY_INIT;
359 BYTE* pOldYUVData[3] = WINPR_C_ARRAY_INIT;
361 if (!h264 || !regionRect || !meta || !h264->Compressor)
364 if (!h264->subsystem->Compress)
367 if (!avc420_ensure_buffer(h264, nSrcStep, nSrcWidth, nSrcHeight))
370 if (h264->encodingBuffer)
372 for (
size_t x = 0; x < 3; x++)
374 pYUVData[x] = h264->pYUVData[x];
375 pOldYUVData[x] = h264->pOldYUVData[x];
380 for (
size_t x = 0; x < 3; x++)
382 pYUVData[x] = h264->pOldYUVData[x];
383 pOldYUVData[x] = h264->pYUVData[x];
386 h264->encodingBuffer = !h264->encodingBuffer;
388 if (!yuv420_context_encode(h264->yuv, pSrcData, nSrcStep, SrcFormat, h264->iStride, pYUVData,
392 if (!detect_changes(h264->firstLumaFrameDone, h264->QP, regionRect, pYUVData, pOldYUVData,
393 h264->iStride, meta))
396 if (meta->numRegionRects == 0)
402 for (
size_t x = 0; x < 3; x++)
403 pcYUVData[x] = pYUVData[x];
405 rc = h264->subsystem->Compress(h264, pcYUVData, h264->iStride, ppDstData, pDstSize);
407 h264->firstLumaFrameDone = TRUE;
411 free_h264_metablock(meta);
415INT32 avc444_compress(H264_CONTEXT* h264,
const BYTE* pSrcData, DWORD SrcFormat, UINT32 nSrcStep,
416 UINT32 nSrcWidth, UINT32 nSrcHeight, BYTE version,
const RECTANGLE_16* region,
417 BYTE* op, BYTE** ppDstData, UINT32* pDstSize, BYTE** ppAuxDstData,
422 BYTE* coded =
nullptr;
423 UINT32 codedSize = 0;
424 BYTE** pYUV444Data =
nullptr;
425 BYTE** pOldYUV444Data =
nullptr;
426 BYTE** pYUVData =
nullptr;
427 BYTE** pOldYUVData =
nullptr;
429 if (!h264 || !h264->Compressor)
432 if (!h264->subsystem->Compress)
435 if (!avc420_ensure_buffer(h264, nSrcStep, nSrcWidth, nSrcHeight))
438 if (!avc444_ensure_buffer(h264, nSrcHeight))
441 if (h264->encodingBuffer)
443 pYUV444Data = h264->pOldYUV444Data;
444 pOldYUV444Data = h264->pYUV444Data;
445 pYUVData = h264->pOldYUVData;
446 pOldYUVData = h264->pYUVData;
450 pYUV444Data = h264->pYUV444Data;
451 pOldYUV444Data = h264->pOldYUV444Data;
452 pYUVData = h264->pYUVData;
453 pOldYUVData = h264->pOldYUVData;
455 h264->encodingBuffer = !h264->encodingBuffer;
457 if (!yuv444_context_encode(h264->yuv, version, pSrcData, nSrcStep, SrcFormat, h264->iStride,
458 pYUV444Data, pYUVData, region, 1))
461 if (!detect_changes(h264->firstLumaFrameDone, h264->QP, region, pYUV444Data, pOldYUV444Data,
462 h264->iStride, meta))
464 if (!detect_changes(h264->firstChromaFrameDone, h264->QP, region, pYUVData, pOldYUVData,
465 h264->iStride, auxMeta))
474 if ((meta->numRegionRects > 0) && (auxMeta->numRegionRects > 0))
476 else if (meta->numRegionRects > 0)
478 else if (auxMeta->numRegionRects > 0)
482 WLog_Print(h264->log, WLOG_TRACE,
"no changes detected for luma or chroma frame");
487 if ((*op == 0) || (*op == 1))
489 const BYTE* pcYUV444Data[3] = { pYUV444Data[0], pYUV444Data[1], pYUV444Data[2] };
491 if (h264->subsystem->Compress(h264, pcYUV444Data, h264->iStride, &coded, &codedSize) < 0)
493 h264->firstLumaFrameDone = TRUE;
494 memcpy(h264->lumaData, coded, codedSize);
495 *ppDstData = h264->lumaData;
496 *pDstSize = codedSize;
499 if ((*op == 0) || (*op == 2))
501 const BYTE* pcYUVData[3] = { pYUVData[0], pYUVData[1], pYUVData[2] };
503 if (h264->subsystem->Compress(h264, pcYUVData, h264->iStride, &coded, &codedSize) < 0)
505 h264->firstChromaFrameDone = TRUE;
506 *ppAuxDstData = coded;
507 *pAuxDstSize = codedSize;
514 free_h264_metablock(meta);
515 free_h264_metablock(auxMeta);
520BOOL avc444_ensure_buffer(H264_CONTEXT* h264, DWORD nDstHeight)
524 const UINT32* piMainStride = h264->iStride;
525 UINT32* piDstSize = h264->iYUV444Size;
526 UINT32* piDstStride = h264->iYUV444Stride;
527 BYTE** ppYUVDstData = h264->pYUV444Data;
528 BYTE** ppOldYUVDstData = h264->pOldYUV444Data;
530 nDstHeight = MAX(h264->height, nDstHeight);
531 const UINT32 pad = nDstHeight % 16;
532 UINT32 padDstHeight = nDstHeight;
535 padDstHeight += 16 - pad;
540 if ((piMainStride[0] == 0) || (padDstHeight == 0))
543 const uint64_t dstsize = 1ull * piMainStride[0] * padDstHeight;
544 if (dstsize > UINT32_MAX)
547 if ((piMainStride[0] != piDstStride[0]) || (piDstSize[0] != dstsize))
549 for (UINT32 x = 0; x < 3; x++)
551 piDstStride[x] = piMainStride[0];
553 const uint64_t dstride = 1ull * piDstStride[x] * padDstHeight;
554 if (dstride > UINT32_MAX)
557 piDstSize[x] = WINPR_ASSERTING_INT_CAST(UINT32, dstride);
558 if (piDstSize[x] == 0)
561 BYTE* tmp1 = winpr_aligned_recalloc(ppYUVDstData[x], piDstSize[x], 1, 16);
564 ppYUVDstData[x] = tmp1;
565 BYTE* tmp2 = winpr_aligned_recalloc(ppOldYUVDstData[x], piDstSize[x], 1, 16);
568 ppOldYUVDstData[x] = tmp2;
572 BYTE* tmp = winpr_aligned_recalloc(h264->lumaData, piDstSize[0], 4, 16);
575 h264->lumaData = tmp;
579 for (UINT32 x = 0; x < 3; x++)
581 if (!ppOldYUVDstData[x] || !ppYUVDstData[x] || (piDstSize[x] == 0) || (piDstStride[x] == 0))
583 WLog_Print(h264->log, WLOG_ERROR,
584 "YUV buffer not initialized! check your decoder settings");
598static BOOL avc444_process_rects(H264_CONTEXT* h264,
const BYTE* pSrcData, UINT32 SrcSize,
599 BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
600 WINPR_ATTR_UNUSED UINT32 nDstWidth, UINT32 nDstHeight,
601 const RECTANGLE_16* rects, UINT32 nrRects, avc444_frame_type type)
603 const BYTE* pYUVData[3] = WINPR_C_ARRAY_INIT;
604 BYTE* pYUVDstData[3] = WINPR_C_ARRAY_INIT;
605 UINT32* piDstStride = h264->iYUV444Stride;
606 BYTE** ppYUVDstData = h264->pYUV444Data;
607 const UINT32* piStride = h264->iStride;
609 const int status = log_decompress(h264, pSrcData, SrcSize, rects, nrRects);
615 pYUVData[0] = h264->pYUVData[0];
616 pYUVData[1] = h264->pYUVData[1];
617 pYUVData[2] = h264->pYUVData[2];
618 if (!avc444_ensure_buffer(h264, nDstHeight))
621 pYUVDstData[0] = ppYUVDstData[0];
622 pYUVDstData[1] = ppYUVDstData[1];
623 pYUVDstData[2] = ppYUVDstData[2];
624 return (yuv444_context_decode(h264->yuv, (BYTE)type, pYUVData, piStride, h264->YUVHeight,
625 pYUVDstData, piDstStride, DstFormat, pDstData, nDstStep, rects,
629#if defined(AVC444_FRAME_STAT)
630static UINT64 op1 = 0;
631static double op1sum = 0;
632static UINT64 op2 = 0;
633static double op2sum = 0;
634static UINT64 op3 = 0;
635static double op3sum = 0;
636static double avg(UINT64* count,
double old,
double size)
638 double tmp = size + *count * old;
645INT32 avc444_decompress(H264_CONTEXT* h264, BYTE op,
const RECTANGLE_16* regionRects,
646 UINT32 numRegionRects,
const BYTE* pSrcData, UINT32 SrcSize,
647 const RECTANGLE_16* auxRegionRects, UINT32 numAuxRegionRect,
648 const BYTE* pAuxSrcData, UINT32 AuxSrcSize, BYTE* pDstData, DWORD DstFormat,
649 UINT32 nDstStep, UINT32 nDstWidth, UINT32 nDstHeight, UINT32 codecId)
652 avc444_frame_type chroma =
653 (codecId == RDPGFX_CODECID_AVC444) ? AVC444_CHROMAv1 : AVC444_CHROMAv2;
655 if (!h264 || !regionRects || !pSrcData || !pDstData || h264->Compressor)
658 if (!areRectsValid(h264->log, nDstWidth, nDstHeight, regionRects, numRegionRects))
660 if (!areRectsValid(h264->log, nDstWidth, nDstHeight, auxRegionRects, numAuxRegionRect))
667 if (!avc444_process_rects(h264, pSrcData, SrcSize, pDstData, DstFormat, nDstStep,
668 nDstWidth, nDstHeight, regionRects, numRegionRects,
671 else if (!avc444_process_rects(h264, pAuxSrcData, AuxSrcSize, pDstData, DstFormat,
672 nDstStep, nDstWidth, nDstHeight, auxRegionRects,
673 numAuxRegionRect, chroma))
681 if (!avc444_process_rects(h264, pSrcData, SrcSize, pDstData, DstFormat, nDstStep,
682 nDstWidth, nDstHeight, regionRects, numRegionRects, chroma))
690 if (!avc444_process_rects(h264, pSrcData, SrcSize, pDstData, DstFormat, nDstStep,
691 nDstWidth, nDstHeight, regionRects, numRegionRects,
703#if defined(AVC444_FRAME_STAT)
708 op1sum = avg(&op1, op1sum, SrcSize + AuxSrcSize);
712 op2sum = avg(&op2, op2sum, SrcSize);
716 op3sum = avg(&op3, op3sum, SrcSize);
723 WLog_Print(h264->log, WLOG_INFO,
724 "luma=%" PRIu64
" [avg=%lf] chroma=%" PRIu64
" [avg=%lf] combined=%" PRIu64
726 op1, op1sum, op2, op2sum, op3, op3sum);
731#define MAX_SUBSYSTEMS 10
732static INIT_ONCE subsystems_once = INIT_ONCE_STATIC_INIT;
733static const H264_CONTEXT_SUBSYSTEM* subSystems[MAX_SUBSYSTEMS] = WINPR_C_ARRAY_INIT;
736static BOOL CALLBACK h264_register_subsystems(WINPR_ATTR_UNUSED
PINIT_ONCE once,
737 WINPR_ATTR_UNUSED PVOID param,
738 WINPR_ATTR_UNUSED PVOID* context)
742#ifdef WITH_MEDIACODEC
744 subSystems[i] = &g_Subsystem_mediacodec;
748#if defined(_WIN32) && defined(WITH_MEDIA_FOUNDATION)
750 subSystems[i] = &g_Subsystem_MF;
756 subSystems[i] = &g_Subsystem_OpenH264;
760#ifdef WITH_VIDEO_FFMPEG
762 subSystems[i] = &g_Subsystem_libavcodec;
770static BOOL h264_context_init(H264_CONTEXT* h264)
775 h264->subsystem =
nullptr;
776 if (!InitOnceExecuteOnce(&subsystems_once, h264_register_subsystems,
nullptr,
nullptr))
779 for (
size_t i = 0; i < MAX_SUBSYSTEMS; i++)
781 const H264_CONTEXT_SUBSYSTEM* subsystem = subSystems[i];
783 if (!subsystem || !subsystem->Init)
786 if (subsystem->Init(h264))
788 h264->subsystem = subsystem;
796BOOL h264_context_reset(H264_CONTEXT* h264, UINT32 width, UINT32 height)
802 h264->height = height;
804 if (h264->subsystem && h264->subsystem->Uninit)
805 h264->subsystem->Uninit(h264);
806 if (!h264_context_init(h264))
809 return yuv_context_reset(h264->yuv, width, height);
812H264_CONTEXT* h264_context_new(BOOL Compressor)
814 H264_CONTEXT* h264 = (H264_CONTEXT*)calloc(1,
sizeof(H264_CONTEXT));
818 h264->log = WLog_Get(TAG);
823 h264->Compressor = Compressor;
827 h264->BitRate = 1000000;
828 h264->FrameRate = 30;
831 if (!h264_context_init(h264))
834 h264->yuv = yuv_context_new(Compressor, 0);
841 WINPR_PRAGMA_DIAG_PUSH
842 WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
843 h264_context_free(h264);
844 WINPR_PRAGMA_DIAG_POP
848void h264_context_free(H264_CONTEXT* h264)
854 WINPR_ASSERT(h264->subsystem->Uninit);
855 h264->subsystem->Uninit(h264);
858 for (
size_t x = 0; x < 3; x++)
860 if (h264->Compressor)
862 winpr_aligned_free(h264->pYUVData[x]);
863 winpr_aligned_free(h264->pOldYUVData[x]);
865 winpr_aligned_free(h264->pYUV444Data[x]);
866 winpr_aligned_free(h264->pOldYUV444Data[x]);
868 winpr_aligned_free(h264->lumaData);
870 yuv_context_free(h264->yuv);
880 free(meta->quantQualityVals);
881 free(meta->regionRects);
885BOOL h264_context_set_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option, UINT32 value)
890 case H264_CONTEXT_OPTION_BITRATE:
891 h264->BitRate = value;
893 case H264_CONTEXT_OPTION_FRAMERATE:
894 h264->FrameRate = value;
896 case H264_CONTEXT_OPTION_RATECONTROL:
900 case H264_RATECONTROL_VBR:
901 h264->RateControlMode = H264_RATECONTROL_VBR;
903 case H264_RATECONTROL_CQP:
904 h264->RateControlMode = H264_RATECONTROL_CQP;
907 WLog_Print(h264->log, WLOG_WARN,
908 "Unknown H264_CONTEXT_OPTION_RATECONTROL value [0x%08" PRIx32
"]",
914 case H264_CONTEXT_OPTION_QP:
917 case H264_CONTEXT_OPTION_USAGETYPE:
918 h264->UsageType = value;
920 case H264_CONTEXT_OPTION_HW_ACCEL:
921 h264->hwAccel = (value);
922 IFCALL(h264->subsystem->Uninit, h264);
923 return IFCALLRESULT(TRUE, h264->subsystem->Init, h264);
925 WLog_Print(h264->log, WLOG_WARN,
"Unknown H264_CONTEXT_OPTION[0x%08" PRIx32
"]",
931UINT32 h264_context_get_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option)
936 case H264_CONTEXT_OPTION_BITRATE:
937 return h264->BitRate;
938 case H264_CONTEXT_OPTION_FRAMERATE:
939 return h264->FrameRate;
940 case H264_CONTEXT_OPTION_RATECONTROL:
941 return h264->RateControlMode;
942 case H264_CONTEXT_OPTION_QP:
944 case H264_CONTEXT_OPTION_USAGETYPE:
945 return h264->UsageType;
946 case H264_CONTEXT_OPTION_HW_ACCEL:
947 return h264->hwAccel;
949 WLog_Print(h264->log, WLOG_WARN,
"Unknown H264_CONTEXT_OPTION[0x%08" PRIx32
"]",