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;
55 stride += 32 - stride % 16;
56 pheight += 32 - pheight % 16;
58 const size_t nPlanes = h264->hwAccel ? 2 : 3;
60 for (
size_t x = 0; x < nPlanes; x++)
62 if (!h264->pYUVData[x] || !h264->pOldYUVData[x])
71 if (isNull || (width != h264->width) || (height != h264->height) ||
72 (stride != h264->iStride[0]))
76 h264->iStride[0] = stride;
77 h264->iStride[1] = stride;
82 h264->iStride[0] = stride;
83 h264->iStride[1] = (stride + 1) / 2;
84 h264->iStride[2] = (stride + 1) / 2;
87 for (
size_t x = 0; x < nPlanes; x++)
89 BYTE* tmp1 = winpr_aligned_recalloc(h264->pYUVData[x], h264->iStride[x], pheight, 16);
91 winpr_aligned_recalloc(h264->pOldYUVData[x], h264->iStride[x], pheight, 16);
93 h264->pYUVData[x] = tmp1;
95 h264->pOldYUVData[x] = tmp2;
100 h264->height = height;
106BOOL avc420_ensure_buffer(H264_CONTEXT* h264, UINT32 stride, UINT32 width, UINT32 height)
108 return yuv_ensure_buffer(h264, stride, width, height);
111static BOOL isRectValid(UINT32 width, UINT32 height,
const RECTANGLE_16* rect)
114 if (rect->left > width)
116 if (rect->right > width)
118 if (rect->left >= rect->right)
120 if (rect->top > height)
122 if (rect->bottom > height)
124 if (rect->top >= rect->bottom)
129static BOOL areRectsValid(wLog* log, UINT32 width, UINT32 height,
const RECTANGLE_16* rects,
132 WINPR_ASSERT(rects || (count == 0));
133 for (
size_t x = 0; x < count; x++)
136 if (!isRectValid(width, height, rect))
138 char buffer[64] = WINPR_C_ARRAY_INIT;
139 WLog_Print(log, WLOG_WARN,
140 "Rectangle %" PRIuz
" %s outside of bounding frame %" PRIu32
"x%" PRIu32, x,
141 rectangle_to_string(rect, buffer,
sizeof(buffer)), width, height);
148static int log_decompress(H264_CONTEXT* h264,
const BYTE* pSrcData, UINT32 SrcSize,
152 WINPR_ASSERT(h264->subsystem);
153 WINPR_ASSERT(h264->subsystem->Decompress);
155 const int status = h264->subsystem->Decompress(h264, pSrcData, SrcSize);
158 WLog_Print(h264->log, WLOG_WARN,
"H264 decompress failed with %d", status);
164 if (!areRectsValid(h264->log, h264->YUVWidth, h264->YUVHeight, rects, nrRects))
166 if (!areRectsValid(h264->log, h264->width, h264->height, rects, nrRects))
171INT32 avc420_decompress(H264_CONTEXT* h264,
const BYTE* pSrcData, UINT32 SrcSize, BYTE* pDstData,
172 DWORD DstFormat, UINT32 nDstStep, WINPR_ATTR_UNUSED UINT32 nDstWidth,
173 WINPR_ATTR_UNUSED UINT32 nDstHeight,
const RECTANGLE_16* regionRects,
174 UINT32 numRegionRects)
177 const BYTE* pYUVData[3];
179 if (!h264 || h264->Compressor)
182 if (!areRectsValid(h264->log, nDstWidth, nDstHeight, regionRects, numRegionRects))
185 status = log_decompress(h264, pSrcData, SrcSize, regionRects, numRegionRects);
193 pYUVData[0] = h264->pYUVData[0];
194 pYUVData[1] = h264->pYUVData[1];
195 pYUVData[2] = h264->pYUVData[2];
196 if (!yuv420_context_decode(h264->yuv, pYUVData, h264->iStride, h264->YUVHeight, DstFormat,
197 pDstData, nDstStep, regionRects, numRegionRects))
203static BOOL allocate_h264_metablock(UINT32 QP,
RECTANGLE_16* rectangles,
207 if (!meta || (QP > UINT8_MAX))
213 meta->regionRects = rectangles;
217 if (count > UINT32_MAX)
222 if (!meta->quantQualityVals || !meta->regionRects)
224 meta->numRegionRects = (UINT32)count;
225 for (
size_t x = 0; x < count; x++)
232 cur->qualityVal = 100 - (QP & 0x3F);
237static inline BOOL diff_tile(
const RECTANGLE_16* regionRect, BYTE* pYUVData[3],
238 BYTE* pOldYUVData[3], UINT32
const iStride[3])
242 if (!regionRect || !pYUVData || !pOldYUVData || !iStride)
244 size = regionRect->right - regionRect->left;
245 if (regionRect->right > iStride[0])
247 if (regionRect->right / 2u > iStride[1])
249 if (regionRect->right / 2u > iStride[2])
252 for (
size_t y = regionRect->top; y < regionRect->bottom; y++)
254 const BYTE* cur0 = &pYUVData[0][y * iStride[0]];
255 const BYTE* cur1 = &pYUVData[1][y * iStride[1]];
256 const BYTE* cur2 = &pYUVData[2][y * iStride[2]];
257 const BYTE* old0 = &pOldYUVData[0][y * iStride[0]];
258 const BYTE* old1 = &pOldYUVData[1][y * iStride[1]];
259 const BYTE* old2 = &pOldYUVData[2][y * iStride[2]];
261 if (memcmp(&cur0[regionRect->left], &old0[regionRect->left], size) != 0)
263 if (memcmp(&cur1[regionRect->left / 2], &old1[regionRect->left / 2], size / 2) != 0)
265 if (memcmp(&cur2[regionRect->left / 2], &old2[regionRect->left / 2], size / 2) != 0)
271static BOOL detect_changes(BOOL firstFrameDone,
const UINT32 QP,
const RECTANGLE_16* regionRect,
272 BYTE* pYUVData[3], BYTE* pOldYUVData[3], UINT32
const iStride[3],
280 if (!regionRect || !pYUVData || !pOldYUVData || !iStride || !meta)
283 wc = (regionRect->right - regionRect->left) / 64 + 1;
284 hc = (regionRect->bottom - regionRect->top) / 64 + 1;
290 rectangles[0] = *regionRect;
295 for (
size_t y = 0; y < regionRect->bottom - regionRect->top; y += 64)
297 for (
size_t x = 0; x < regionRect->right - regionRect->left; x += 64)
300 rect.left = (UINT16)MIN(UINT16_MAX, regionRect->left + x);
301 rect.top = (UINT16)MIN(UINT16_MAX, regionRect->top + y);
303 (UINT16)MIN(UINT16_MAX, MIN(regionRect->left + x + 64, regionRect->right));
305 (UINT16)MIN(UINT16_MAX, MIN(regionRect->top + y + 64, regionRect->bottom));
306 if (diff_tile(&rect, pYUVData, pOldYUVData, iStride))
307 rectangles[count++] = rect;
311 if (!allocate_h264_metablock(QP, rectangles, meta, count))
316INT32 h264_get_yuv_buffer(H264_CONTEXT* h264, UINT32 nSrcStride, UINT32 nSrcWidth,
317 UINT32 nSrcHeight, BYTE* YUVData[3], UINT32 stride[3])
319 if (!h264 || !h264->Compressor || !h264->subsystem || !h264->subsystem->Compress)
322 if (!yuv_ensure_buffer(h264, nSrcStride, nSrcWidth, nSrcHeight))
325 for (
size_t x = 0; x < 3; x++)
327 YUVData[x] = h264->pYUVData[x];
328 stride[x] = h264->iStride[x];
334INT32 h264_compress(H264_CONTEXT* h264, BYTE** ppDstData, UINT32* pDstSize)
336 if (!h264 || !h264->Compressor || !h264->subsystem || !h264->subsystem->Compress)
339 const BYTE* pcYUVData[3] = { h264->pYUVData[0], h264->pYUVData[1], h264->pYUVData[2] };
341 return h264->subsystem->Compress(h264, pcYUVData, h264->iStride, ppDstData, pDstSize);
344INT32 avc420_compress(H264_CONTEXT* h264,
const BYTE* pSrcData, DWORD SrcFormat, UINT32 nSrcStep,
345 UINT32 nSrcWidth, UINT32 nSrcHeight,
const RECTANGLE_16* regionRect,
349 BYTE* pYUVData[3] = WINPR_C_ARRAY_INIT;
350 const BYTE* pcYUVData[3] = WINPR_C_ARRAY_INIT;
351 BYTE* pOldYUVData[3] = WINPR_C_ARRAY_INIT;
353 if (!h264 || !regionRect || !meta || !h264->Compressor)
356 if (!h264->subsystem->Compress)
359 if (!avc420_ensure_buffer(h264, nSrcStep, nSrcWidth, nSrcHeight))
362 if (h264->encodingBuffer)
364 for (
size_t x = 0; x < 3; x++)
366 pYUVData[x] = h264->pYUVData[x];
367 pOldYUVData[x] = h264->pOldYUVData[x];
372 for (
size_t x = 0; x < 3; x++)
374 pYUVData[x] = h264->pOldYUVData[x];
375 pOldYUVData[x] = h264->pYUVData[x];
378 h264->encodingBuffer = !h264->encodingBuffer;
380 if (!yuv420_context_encode(h264->yuv, pSrcData, nSrcStep, SrcFormat, h264->iStride, pYUVData,
384 if (!detect_changes(h264->firstLumaFrameDone, h264->QP, regionRect, pYUVData, pOldYUVData,
385 h264->iStride, meta))
388 if (meta->numRegionRects == 0)
394 for (
size_t x = 0; x < 3; x++)
395 pcYUVData[x] = pYUVData[x];
397 rc = h264->subsystem->Compress(h264, pcYUVData, h264->iStride, ppDstData, pDstSize);
399 h264->firstLumaFrameDone = TRUE;
403 free_h264_metablock(meta);
407INT32 avc444_compress(H264_CONTEXT* h264,
const BYTE* pSrcData, DWORD SrcFormat, UINT32 nSrcStep,
408 UINT32 nSrcWidth, UINT32 nSrcHeight, BYTE version,
const RECTANGLE_16* region,
409 BYTE* op, BYTE** ppDstData, UINT32* pDstSize, BYTE** ppAuxDstData,
414 BYTE* coded =
nullptr;
415 UINT32 codedSize = 0;
416 BYTE** pYUV444Data =
nullptr;
417 BYTE** pOldYUV444Data =
nullptr;
418 BYTE** pYUVData =
nullptr;
419 BYTE** pOldYUVData =
nullptr;
421 if (!h264 || !h264->Compressor)
424 if (!h264->subsystem->Compress)
427 if (!avc420_ensure_buffer(h264, nSrcStep, nSrcWidth, nSrcHeight))
430 if (!avc444_ensure_buffer(h264, nSrcHeight))
433 if (h264->encodingBuffer)
435 pYUV444Data = h264->pOldYUV444Data;
436 pOldYUV444Data = h264->pYUV444Data;
437 pYUVData = h264->pOldYUVData;
438 pOldYUVData = h264->pYUVData;
442 pYUV444Data = h264->pYUV444Data;
443 pOldYUV444Data = h264->pOldYUV444Data;
444 pYUVData = h264->pYUVData;
445 pOldYUVData = h264->pOldYUVData;
447 h264->encodingBuffer = !h264->encodingBuffer;
449 if (!yuv444_context_encode(h264->yuv, version, pSrcData, nSrcStep, SrcFormat, h264->iStride,
450 pYUV444Data, pYUVData, region, 1))
453 if (!detect_changes(h264->firstLumaFrameDone, h264->QP, region, pYUV444Data, pOldYUV444Data,
454 h264->iStride, meta))
456 if (!detect_changes(h264->firstChromaFrameDone, h264->QP, region, pYUVData, pOldYUVData,
457 h264->iStride, auxMeta))
466 if ((meta->numRegionRects > 0) && (auxMeta->numRegionRects > 0))
468 else if (meta->numRegionRects > 0)
470 else if (auxMeta->numRegionRects > 0)
474 WLog_Print(h264->log, WLOG_TRACE,
"no changes detected for luma or chroma frame");
479 if ((*op == 0) || (*op == 1))
481 const BYTE* pcYUV444Data[3] = { pYUV444Data[0], pYUV444Data[1], pYUV444Data[2] };
483 if (h264->subsystem->Compress(h264, pcYUV444Data, h264->iStride, &coded, &codedSize) < 0)
485 h264->firstLumaFrameDone = TRUE;
486 memcpy(h264->lumaData, coded, codedSize);
487 *ppDstData = h264->lumaData;
488 *pDstSize = codedSize;
491 if ((*op == 0) || (*op == 2))
493 const BYTE* pcYUVData[3] = { pYUVData[0], pYUVData[1], pYUVData[2] };
495 if (h264->subsystem->Compress(h264, pcYUVData, h264->iStride, &coded, &codedSize) < 0)
497 h264->firstChromaFrameDone = TRUE;
498 *ppAuxDstData = coded;
499 *pAuxDstSize = codedSize;
506 free_h264_metablock(meta);
507 free_h264_metablock(auxMeta);
512BOOL avc444_ensure_buffer(H264_CONTEXT* h264, DWORD nDstHeight)
516 const UINT32* piMainStride = h264->iStride;
517 UINT32* piDstSize = h264->iYUV444Size;
518 UINT32* piDstStride = h264->iYUV444Stride;
519 BYTE** ppYUVDstData = h264->pYUV444Data;
520 BYTE** ppOldYUVDstData = h264->pOldYUV444Data;
522 nDstHeight = MAX(h264->height, nDstHeight);
523 const UINT32 pad = nDstHeight % 16;
524 UINT32 padDstHeight = nDstHeight;
527 padDstHeight += 16 - pad;
532 if ((piMainStride[0] == 0) || (padDstHeight == 0))
535 const uint64_t dstsize = 1ull * piMainStride[0] * padDstHeight;
536 if (dstsize > UINT32_MAX)
539 if ((piMainStride[0] != piDstStride[0]) || (piDstSize[0] != dstsize))
541 for (UINT32 x = 0; x < 3; x++)
543 piDstStride[x] = piMainStride[0];
545 const uint64_t dstride = 1ull * piDstStride[x] * padDstHeight;
546 if (dstride > UINT32_MAX)
549 piDstSize[x] = WINPR_ASSERTING_INT_CAST(UINT32, dstride);
550 if (piDstSize[x] == 0)
553 BYTE* tmp1 = winpr_aligned_recalloc(ppYUVDstData[x], piDstSize[x], 1, 16);
556 ppYUVDstData[x] = tmp1;
557 BYTE* tmp2 = winpr_aligned_recalloc(ppOldYUVDstData[x], piDstSize[x], 1, 16);
560 ppOldYUVDstData[x] = tmp2;
564 BYTE* tmp = winpr_aligned_recalloc(h264->lumaData, piDstSize[0], 4, 16);
567 h264->lumaData = tmp;
571 for (UINT32 x = 0; x < 3; x++)
573 if (!ppOldYUVDstData[x] || !ppYUVDstData[x] || (piDstSize[x] == 0) || (piDstStride[x] == 0))
575 WLog_Print(h264->log, WLOG_ERROR,
576 "YUV buffer not initialized! check your decoder settings");
589static BOOL avc444_process_rects(H264_CONTEXT* h264,
const BYTE* pSrcData, UINT32 SrcSize,
590 BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
591 WINPR_ATTR_UNUSED UINT32 nDstWidth, UINT32 nDstHeight,
592 const RECTANGLE_16* rects, UINT32 nrRects, avc444_frame_type type)
594 const BYTE* pYUVData[3] = WINPR_C_ARRAY_INIT;
595 BYTE* pYUVDstData[3] = WINPR_C_ARRAY_INIT;
596 UINT32* piDstStride = h264->iYUV444Stride;
597 BYTE** ppYUVDstData = h264->pYUV444Data;
598 const UINT32* piStride = h264->iStride;
600 if (log_decompress(h264, pSrcData, SrcSize, rects, nrRects) < 0)
603 pYUVData[0] = h264->pYUVData[0];
604 pYUVData[1] = h264->pYUVData[1];
605 pYUVData[2] = h264->pYUVData[2];
606 if (!avc444_ensure_buffer(h264, nDstHeight))
609 pYUVDstData[0] = ppYUVDstData[0];
610 pYUVDstData[1] = ppYUVDstData[1];
611 pYUVDstData[2] = ppYUVDstData[2];
612 return (yuv444_context_decode(h264->yuv, (BYTE)type, pYUVData, piStride, h264->YUVHeight,
613 pYUVDstData, piDstStride, DstFormat, pDstData, nDstStep, rects,
617#if defined(AVC444_FRAME_STAT)
618static UINT64 op1 = 0;
619static double op1sum = 0;
620static UINT64 op2 = 0;
621static double op2sum = 0;
622static UINT64 op3 = 0;
623static double op3sum = 0;
624static double avg(UINT64* count,
double old,
double size)
626 double tmp = size + *count * old;
633INT32 avc444_decompress(H264_CONTEXT* h264, BYTE op,
const RECTANGLE_16* regionRects,
634 UINT32 numRegionRects,
const BYTE* pSrcData, UINT32 SrcSize,
635 const RECTANGLE_16* auxRegionRects, UINT32 numAuxRegionRect,
636 const BYTE* pAuxSrcData, UINT32 AuxSrcSize, BYTE* pDstData, DWORD DstFormat,
637 UINT32 nDstStep, UINT32 nDstWidth, UINT32 nDstHeight, UINT32 codecId)
640 avc444_frame_type chroma =
641 (codecId == RDPGFX_CODECID_AVC444) ? AVC444_CHROMAv1 : AVC444_CHROMAv2;
643 if (!h264 || !regionRects || !pSrcData || !pDstData || h264->Compressor)
646 if (!areRectsValid(h264->log, nDstWidth, nDstHeight, regionRects, numRegionRects))
648 if (!areRectsValid(h264->log, nDstWidth, nDstHeight, auxRegionRects, numAuxRegionRect))
655 if (!avc444_process_rects(h264, pSrcData, SrcSize, pDstData, DstFormat, nDstStep,
656 nDstWidth, nDstHeight, regionRects, numRegionRects,
659 else if (!avc444_process_rects(h264, pAuxSrcData, AuxSrcSize, pDstData, DstFormat,
660 nDstStep, nDstWidth, nDstHeight, auxRegionRects,
661 numAuxRegionRect, chroma))
669 if (!avc444_process_rects(h264, pSrcData, SrcSize, pDstData, DstFormat, nDstStep,
670 nDstWidth, nDstHeight, regionRects, numRegionRects, chroma))
678 if (!avc444_process_rects(h264, pSrcData, SrcSize, pDstData, DstFormat, nDstStep,
679 nDstWidth, nDstHeight, regionRects, numRegionRects,
691#if defined(AVC444_FRAME_STAT)
696 op1sum = avg(&op1, op1sum, SrcSize + AuxSrcSize);
700 op2sum = avg(&op2, op2sum, SrcSize);
704 op3sum = avg(&op3, op3sum, SrcSize);
711 WLog_Print(h264->log, WLOG_INFO,
712 "luma=%" PRIu64
" [avg=%lf] chroma=%" PRIu64
" [avg=%lf] combined=%" PRIu64
714 op1, op1sum, op2, op2sum, op3, op3sum);
719#define MAX_SUBSYSTEMS 10
720static INIT_ONCE subsystems_once = INIT_ONCE_STATIC_INIT;
721static const H264_CONTEXT_SUBSYSTEM* subSystems[MAX_SUBSYSTEMS] = WINPR_C_ARRAY_INIT;
723static BOOL CALLBACK h264_register_subsystems(WINPR_ATTR_UNUSED
PINIT_ONCE once,
724 WINPR_ATTR_UNUSED PVOID param,
725 WINPR_ATTR_UNUSED PVOID* context)
729#ifdef WITH_MEDIACODEC
731 subSystems[i] = &g_Subsystem_mediacodec;
735#if defined(_WIN32) && defined(WITH_MEDIA_FOUNDATION)
737 subSystems[i] = &g_Subsystem_MF;
743 subSystems[i] = &g_Subsystem_OpenH264;
747#ifdef WITH_VIDEO_FFMPEG
749 subSystems[i] = &g_Subsystem_libavcodec;
756static BOOL h264_context_init(H264_CONTEXT* h264)
761 h264->subsystem =
nullptr;
762 if (!InitOnceExecuteOnce(&subsystems_once, h264_register_subsystems,
nullptr,
nullptr))
765 for (
size_t i = 0; i < MAX_SUBSYSTEMS; i++)
767 const H264_CONTEXT_SUBSYSTEM* subsystem = subSystems[i];
769 if (!subsystem || !subsystem->Init)
772 if (subsystem->Init(h264))
774 h264->subsystem = subsystem;
782BOOL h264_context_reset(H264_CONTEXT* h264, UINT32 width, UINT32 height)
788 h264->height = height;
790 if (h264->subsystem && h264->subsystem->Uninit)
791 h264->subsystem->Uninit(h264);
792 if (!h264_context_init(h264))
795 return yuv_context_reset(h264->yuv, width, height);
798H264_CONTEXT* h264_context_new(BOOL Compressor)
800 H264_CONTEXT* h264 = (H264_CONTEXT*)calloc(1,
sizeof(H264_CONTEXT));
804 h264->log = WLog_Get(TAG);
809 h264->Compressor = Compressor;
813 h264->BitRate = 1000000;
814 h264->FrameRate = 30;
817 if (!h264_context_init(h264))
820 h264->yuv = yuv_context_new(Compressor, 0);
827 WINPR_PRAGMA_DIAG_PUSH
828 WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
829 h264_context_free(h264);
830 WINPR_PRAGMA_DIAG_POP
834void h264_context_free(H264_CONTEXT* h264)
840 WINPR_ASSERT(h264->subsystem->Uninit);
841 h264->subsystem->Uninit(h264);
844 for (
size_t x = 0; x < 3; x++)
846 if (h264->Compressor)
848 winpr_aligned_free(h264->pYUVData[x]);
849 winpr_aligned_free(h264->pOldYUVData[x]);
851 winpr_aligned_free(h264->pYUV444Data[x]);
852 winpr_aligned_free(h264->pOldYUV444Data[x]);
854 winpr_aligned_free(h264->lumaData);
856 yuv_context_free(h264->yuv);
866 free(meta->quantQualityVals);
867 free(meta->regionRects);
871BOOL h264_context_set_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option, UINT32 value)
876 case H264_CONTEXT_OPTION_BITRATE:
877 h264->BitRate = value;
879 case H264_CONTEXT_OPTION_FRAMERATE:
880 h264->FrameRate = value;
882 case H264_CONTEXT_OPTION_RATECONTROL:
886 case H264_RATECONTROL_VBR:
887 h264->RateControlMode = H264_RATECONTROL_VBR;
889 case H264_RATECONTROL_CQP:
890 h264->RateControlMode = H264_RATECONTROL_CQP;
893 WLog_Print(h264->log, WLOG_WARN,
894 "Unknown H264_CONTEXT_OPTION_RATECONTROL value [0x%08" PRIx32
"]",
900 case H264_CONTEXT_OPTION_QP:
903 case H264_CONTEXT_OPTION_USAGETYPE:
904 h264->UsageType = value;
906 case H264_CONTEXT_OPTION_HW_ACCEL:
907 h264->hwAccel = (value);
910 WLog_Print(h264->log, WLOG_WARN,
"Unknown H264_CONTEXT_OPTION[0x%08" PRIx32
"]",
916UINT32 h264_context_get_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option)
921 case H264_CONTEXT_OPTION_BITRATE:
922 return h264->BitRate;
923 case H264_CONTEXT_OPTION_FRAMERATE:
924 return h264->FrameRate;
925 case H264_CONTEXT_OPTION_RATECONTROL:
926 return h264->RateControlMode;
927 case H264_CONTEXT_OPTION_QP:
929 case H264_CONTEXT_OPTION_USAGETYPE:
930 return h264->UsageType;
931 case H264_CONTEXT_OPTION_HW_ACCEL:
932 return h264->hwAccel;
934 WLog_Print(h264->log, WLOG_WARN,
"Unknown H264_CONTEXT_OPTION[0x%08" PRIx32
"]",