21#include <freerdp/codec/av1.h>
22#include <freerdp/primitives.h>
23#include <freerdp/log.h>
24#include <freerdp/codec/region.h>
26#define TAG FREERDP_TAG("codec.av1")
28#if defined(WITH_LIBAOM)
31#include <aom/aom_decoder.h>
32#include <aom/aom_encoder.h>
34#include <aom/aom_image.h>
39#if defined(WITH_DAV1D)
40#include <dav1d/dav1d.h>
43#if defined(WITH_LIBAOM) || defined(WITH_DAV1D)
45#if defined(WITH_LIBYUV)
49struct S_FREERDP_AV1_CONTEXT
54#if defined(WITH_LIBAOM)
56 aom_codec_enc_cfg_t ecfg;
57 aom_codec_pts_t framecount;
58 aom_enc_frame_flags_t eflags;
59 aom_codec_flags_t flags;
60 aom_codec_iface_t* iface;
62#if defined(WITH_LIBAOM) && !defined(WITH_DAV1D)
63 aom_codec_dec_cfg_t dcfg;
65#if defined(WITH_DAV1D)
74#if defined(WITH_LIBAOM)
75static void av1_aom_destroy(FREERDP_AV1_CONTEXT* av1)
77 const aom_codec_err_t rc = aom_codec_destroy(&av1->ctx);
78 if (rc != AOM_CODEC_OK)
79 WLog_Print(av1->log, WLOG_WARN,
"aom_codec_destroy: %s", aom_codec_err_to_string(rc));
83static BOOL allocate_h264_metablock(UINT32 QP,
RECTANGLE_16* rectangles,
87 if (!meta || (QP > UINT8_MAX))
93 meta->regionRects = rectangles;
97 if (count > UINT32_MAX)
102 if (!meta->quantQualityVals || !meta->regionRects)
104 meta->numRegionRects = (UINT32)count;
105 for (
size_t x = 0; x < count; x++)
112 cur->qualityVal = 100 - (QP & 0x3F);
118BOOL freerdp_av1_context_set_option(FREERDP_AV1_CONTEXT* av1, FREERDP_AV1_CONTEXT_OPTION option,
121#if defined(WITH_LIBAOM)
124 case FREERDP_AV1_CONTEXT_OPTION_PROFILE:
128 av1->ecfg.g_profile = value;
131 case FREERDP_AV1_CONTEXT_OPTION_RATECONTROL:
136 case FREERDP_AV1_VBR:
137 case FREERDP_AV1_CBR:
142 WLog_Print(av1->log, WLOG_WARN,
143 "Unknown FREERDP_AV1_CONTEXT_OPTION_RATECONTROL value [0x%08" PRIx32
148 av1->ecfg.rc_end_usage = value;
150 case FREERDP_AV1_CONTEXT_OPTION_BITRATE:
153 av1->ecfg.rc_target_bitrate = value;
155 case FREERDP_AV1_CONTEXT_OPTION_USAGETYPE:
158 av1->ecfg.g_usage = value;
161 WLog_Print(av1->log, WLOG_ERROR,
"Unknown FREERDP_AV1_CONTEXT_OPTION[0x%08" PRIx32
"]",
165 return freerdp_av1_context_reset(av1, av1->ecfg.g_w, av1->ecfg.g_h);
167 WLog_Print(av1->log, WLOG_WARN,
"AV1 encoder requires libaom, recompile with '-DWITH_AOM=ON'");
168 WINPR_UNUSED(option);
174UINT32 freerdp_av1_context_get_option(FREERDP_AV1_CONTEXT* av1, FREERDP_AV1_CONTEXT_OPTION option)
176#if defined(WITH_LIBAOM)
179 case FREERDP_AV1_CONTEXT_OPTION_PROFILE:
182 return av1->ecfg.g_profile;
183 case FREERDP_AV1_CONTEXT_OPTION_RATECONTROL:
186 return av1->ecfg.rc_end_usage;
187 case FREERDP_AV1_CONTEXT_OPTION_BITRATE:
190 return av1->ecfg.rc_target_bitrate;
191 case FREERDP_AV1_CONTEXT_OPTION_USAGETYPE:
194 return av1->ecfg.g_usage;
196 WLog_Print(av1->log, WLOG_ERROR,
"Unknown FREERDP_AV1_CONTEXT_OPTION[0x%08" PRIx32
"]",
201 WINPR_UNUSED(option);
206INT32 freerdp_av1_compress(FREERDP_AV1_CONTEXT* av1,
const BYTE* pSrcData, DWORD SrcFormat,
207 UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight,
208 const RECTANGLE_16* regionRect, BYTE** ppDstData, UINT32* pDstSize,
211 *ppDstData =
nullptr;
216 WLog_Print(av1->log, WLOG_ERROR,
"av1->encoder: %d", av1->encoder);
220#if defined(WITH_LIBAOM)
224 WLog_Print(av1->log, WLOG_ERROR,
"primitives_get(): nullptr");
228 if (av1->yuvWidth != nSrcWidth)
230 WLog_Print(av1->log, WLOG_ERROR,
"av1->yuvWidth[%" PRIu32
"] != nSrcWidth[%" PRIu32
"]",
231 av1->yuvWidth, nSrcWidth);
235 if (av1->yuvHeight != nSrcHeight)
237 WLog_Print(av1->log, WLOG_ERROR,
"av1->yuvHeight[%" PRIu32
"] != nSrcHeight[%" PRIu32
"]",
238 av1->yuvHeight, nSrcHeight);
242 const prim_size_t roi = { .width = nSrcWidth, .height = nSrcHeight };
244 aom_image_t buffer = WINPR_C_ARRAY_INIT;
246 aom_image_t* img = &buffer;
248#if defined(WITH_LIBYUV)
252 if ((SrcFormat == PIXEL_FORMAT_BGRA32) || (SrcFormat == PIXEL_FORMAT_BGRX32))
254 switch (av1->ecfg.g_profile)
257 img->fmt = AOM_IMG_FMT_I420;
258 img->x_chroma_shift = 1;
259 img->y_chroma_shift = 1;
260 rec = ARGBToI420(pSrcData, nSrcStep, av1->yuvdata[0], av1->yuvStride[0],
261 av1->yuvdata[1], av1->yuvStride[1], av1->yuvdata[2],
262 WINPR_ASSERTING_INT_CAST(
int, av1->yuvStride[2]),
263 WINPR_ASSERTING_INT_CAST(
int, roi.width),
264 WINPR_ASSERTING_INT_CAST(
int, roi.height));
267 img->fmt = AOM_IMG_FMT_I444;
268 rec = ARGBToI444(pSrcData, nSrcStep, av1->yuvdata[0], av1->yuvStride[0],
269 av1->yuvdata[1], av1->yuvStride[1], av1->yuvdata[2],
270 WINPR_ASSERTING_INT_CAST(
int, av1->yuvStride[2]),
271 WINPR_ASSERTING_INT_CAST(
int, roi.width),
272 WINPR_ASSERTING_INT_CAST(
int, roi.height));
275 WLog_Print(av1->log, WLOG_ERROR,
"Unsupoorted AV1 profile %" PRIu32,
276 av1->ecfg.g_profile);
283 switch (av1->ecfg.g_profile)
286 img->fmt = AOM_IMG_FMT_I420;
287 img->x_chroma_shift = 1;
288 img->y_chroma_shift = 1;
289 rec = primitives->RGBToYUV420_8u_P3AC4R(pSrcData, SrcFormat, nSrcStep, av1->yuvdata,
290 av1->yuvStride, &roi);
293 img->fmt = AOM_IMG_FMT_I444;
294 rec = primitives->
RGBToI444_8u(pSrcData, SrcFormat, nSrcStep, av1->yuvdata,
295 av1->yuvStride, &roi);
298 WLog_Print(av1->log, WLOG_ERROR,
"Unsupoorted AV1 profile %" PRIu32,
299 av1->ecfg.g_profile);
305 WLog_Print(av1->log, WLOG_ERROR,
"RGB to YUV conversion failed: %d", rec);
309 img->d_w = img->r_w = img->w = roi.width;
310 img->d_h = img->r_h = img->h = roi.height;
311 img->stride[0] = WINPR_ASSERTING_INT_CAST(
int, av1->yuvStride[0]);
312 img->stride[1] = WINPR_ASSERTING_INT_CAST(
int, av1->yuvStride[1]);
313 img->stride[2] = WINPR_ASSERTING_INT_CAST(
int, av1->yuvStride[2]);
314 img->planes[0] = av1->yuvdata[0];
315 img->planes[1] = av1->yuvdata[1];
316 img->planes[2] = av1->yuvdata[2];
318 const aom_codec_err_t rc = aom_codec_encode(&av1->ctx, img, ++av1->framecount, 1, av1->eflags);
321 if (rc != AOM_CODEC_OK)
323 WLog_Print(av1->log, WLOG_WARN,
"aom_codec_encode: %s", aom_codec_err_to_string(rc));
327 aom_codec_iter_t iter =
nullptr;
328 const aom_codec_cx_pkt_t* pkt =
nullptr;
329 while ((pkt = aom_codec_get_cx_data(&av1->ctx, &iter)) !=
nullptr)
331 if (pkt->kind != AOM_CODEC_CX_FRAME_PKT)
334 *ppDstData = pkt->data.frame.buf;
335 *pDstSize = pkt->data.frame.sz;
343 rect->right = nSrcWidth;
344 rect->bottom = nSrcHeight;
346 return allocate_h264_metablock(10, rect, meta, 1);
348 WLog_Print(av1->log, WLOG_ERROR,
"AV1 encoder requires libaom, recompile with '-DWITH_AOM=ON'");
349 WINPR_UNUSED(pSrcData);
350 WINPR_UNUSED(SrcFormat);
351 WINPR_UNUSED(nSrcStep);
352 WINPR_UNUSED(nSrcWidth);
353 WINPR_UNUSED(nSrcHeight);
354 WINPR_UNUSED(regionRect);
360static BOOL isRectValid(UINT32 width, UINT32 height,
const RECTANGLE_16* rect)
363 if (rect->left > width)
365 if (rect->right > width)
367 if (rect->left >= rect->right)
369 if (rect->top > height)
371 if (rect->bottom > height)
373 if (rect->top >= rect->bottom)
378static BOOL areRectsValid(wLog* log, UINT32 width, UINT32 height,
const RECTANGLE_16* rects,
381 WINPR_ASSERT(rects || (count == 0));
382 for (
size_t x = 0; x < count; x++)
385 if (!isRectValid(width, height, rect))
387 char buffer[64] = WINPR_C_ARRAY_INIT;
388 WLog_Print(log, WLOG_WARN,
389 "Rectangle %" PRIuz
" %s outside of bounding frame %" PRIu32
"x%" PRIu32, x,
390 rectangle_to_string(rect, buffer,
sizeof(buffer)), width, height);
397#if defined(WITH_DAV1D)
398static void av1_dav1d_data_free(WINPR_ATTR_UNUSED
const uint8_t* buf,
399 WINPR_ATTR_UNUSED
void* cookie)
404static INT32 av1_dav1d_convert(FREERDP_AV1_CONTEXT* av1,
const Dav1dPicture* pic, BYTE* pDstData,
405 DWORD DstFormat, UINT32 nDstStep, UINT32 nDstWidth,
407 UINT32 numRegionRect)
411 WLog_Print(av1->log, WLOG_ERROR,
"dav1d picture bpc %d not supported", pic->p.bpc);
418 const UINT32 dw = (UINT32)pic->p.w;
419 const UINT32 dh = (UINT32)pic->p.h;
420 const UINT32 nWidth = (dw < nDstWidth) ? dw : nDstWidth;
421 const UINT32 nHeight = (dh < nDstHeight) ? dh : nDstHeight;
422 const prim_size_t roi = { .width = nWidth, .height = nHeight };
424 if (!areRectsValid(av1->log, roi.width, roi.height, regionRects, numRegionRect))
427 const UINT32 strides[] = { (UINT32)pic->stride[0], (UINT32)pic->stride[1],
428 (UINT32)pic->stride[1] };
431#if defined(WITH_LIBYUV)
435 if ((DstFormat == PIXEL_FORMAT_BGRA32) || (DstFormat == PIXEL_FORMAT_BGRX32))
437 const uint8_t* y = pic->data[0];
438 const uint8_t* u = pic->data[1];
439 const uint8_t* v = pic->data[2];
441 const int stride0 = WINPR_ASSERTING_INT_CAST(
int, strides[0]);
442 const int stride1 = WINPR_ASSERTING_INT_CAST(
int, strides[1]);
443 const int stride2 = WINPR_ASSERTING_INT_CAST(
int, strides[2]);
444 const int iWidth = WINPR_ASSERTING_INT_CAST(
int, nWidth);
445 const int iHeight = WINPR_ASSERTING_INT_CAST(
int, nHeight);
446 const int iDstStep = WINPR_ASSERTING_INT_CAST(
int, nDstStep);
448 switch (pic->p.layout)
450 case DAV1D_PIXEL_LAYOUT_I420:
451 rec = J420ToARGB(y, stride0, u, stride1, v, stride2, pDstData, iDstStep, iWidth,
454 case DAV1D_PIXEL_LAYOUT_I444:
455 rec = J444ToARGB(y, stride0, u, stride1, v, stride2, pDstData, iDstStep, iWidth,
459 WLog_Print(av1->log, WLOG_ERROR,
"dav1d picture layout %d not supported",
470 WLog_Print(av1->log, WLOG_ERROR,
"primitives_get(): nullptr");
474 const BYTE* pSrc[] = { pic->data[0], pic->data[1], pic->data[2] };
475 switch (pic->p.layout)
477 case DAV1D_PIXEL_LAYOUT_I420:
478 rec = primitives->YUV420ToRGB_8u_P3AC4R(pSrc, strides, pDstData, nDstStep,
481 case DAV1D_PIXEL_LAYOUT_I444:
482 rec = primitives->YUV444ToRGB_8u_P3AC4R(pSrc, strides, pDstData, nDstStep,
486 WLog_Print(av1->log, WLOG_ERROR,
"dav1d picture layout %d not supported",
493 WLog_Print(av1->log, WLOG_ERROR,
"RGB to YUV conversion failed: %d", rec);
500static INT32 av1_dav1d_drain_one(FREERDP_AV1_CONTEXT* av1, BYTE* pDstData, DWORD DstFormat,
501 UINT32 nDstStep, UINT32 nDstWidth, UINT32 nDstHeight,
504 Dav1dPicture pic = WINPR_C_ARRAY_INIT;
505 const int prc = dav1d_get_picture(av1->dav1d, &pic);
506 if (prc == DAV1D_ERR(EAGAIN))
510 WLog_Print(av1->log, WLOG_WARN,
"dav1d_get_picture: %d", prc);
514 const INT32 rc = av1_dav1d_convert(av1, &pic, pDstData, DstFormat, nDstStep, nDstWidth,
515 nDstHeight, regionRects, numRegionRect);
516 dav1d_picture_unref(&pic);
517 return (rc == TRUE) ? TRUE : rc;
521INT32 freerdp_av1_decompress(FREERDP_AV1_CONTEXT* av1,
const BYTE* pSrcData, UINT32 SrcSize,
522 BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nDstWidth,
524 UINT32 numRegionRect)
529 WLog_Print(av1->log, WLOG_ERROR,
"av1->encoder: %d", av1->encoder);
533 if (!areRectsValid(av1->log, nDstWidth, nDstHeight, regionRects, numRegionRect))
536#if defined(WITH_DAV1D)
537 Dav1dData data = WINPR_C_ARRAY_INIT;
538 const int wrc = dav1d_data_wrap(&data, pSrcData, SrcSize, av1_dav1d_data_free,
nullptr);
541 WLog_Print(av1->log, WLOG_WARN,
"dav1d_data_wrap: %d", wrc);
547 const int src = dav1d_send_data(av1->dav1d, &data);
548 if ((src < 0) && (src != DAV1D_ERR(EAGAIN)))
550 WLog_Print(av1->log, WLOG_WARN,
"dav1d_send_data: %d", src);
551 dav1d_data_unref(&data);
555 const INT32 rc = av1_dav1d_drain_one(av1, pDstData, DstFormat, nDstStep, nDstWidth,
556 nDstHeight, regionRects, numRegionRect);
557 if ((rc != TRUE) && (rc != FALSE))
559 dav1d_data_unref(&data);
567 const INT32 rc = av1_dav1d_drain_one(av1, pDstData, DstFormat, nDstStep, nDstWidth,
568 nDstHeight, regionRects, numRegionRect);
576#elif defined(WITH_LIBAOM)
577 const aom_codec_err_t rc = aom_codec_decode(&av1->ctx, pSrcData, SrcSize,
nullptr);
578 if (rc != AOM_CODEC_OK)
580 WLog_Print(av1->log, WLOG_WARN,
"aom_codec_decode: %s", aom_codec_err_to_string(rc));
584 aom_image_t* img =
nullptr;
585 aom_codec_iter_t iter =
nullptr;
586 while ((img = aom_codec_get_frame(&av1->ctx, &iter)) !=
nullptr)
591 const UINT32 nWidth = (img->d_w < nDstWidth) ? img->d_w : nDstWidth;
592 const UINT32 nHeight = (img->d_h < nDstHeight) ? img->d_h : nDstHeight;
593 const prim_size_t roi = { .width = nWidth, .height = nHeight };
595 if (!areRectsValid(av1->log, roi.width, roi.height, regionRects, numRegionRect))
599#if defined(WITH_LIBYUV)
603 if ((DstFormat == PIXEL_FORMAT_BGRA32) || (DstFormat == PIXEL_FORMAT_BGRX32))
607 case AOM_IMG_FMT_I420:
608 rec = J420ToARGB(img->planes[0], img->stride[0], img->planes[1], img->stride[1],
609 img->planes[2], img->stride[2], pDstData, nDstStep, nWidth,
612 case AOM_IMG_FMT_I444:
613 rec = J444ToARGB(img->planes[0], img->stride[0], img->planes[1], img->stride[1],
614 img->planes[2], img->stride[2], pDstData, nDstStep, nWidth,
618 WLog_Print(av1->log, WLOG_ERROR,
"img->fmt %d not supported", img->fmt);
625 const BYTE* pSrc[] = { img->planes[0], img->planes[1], img->planes[2] };
626 const UINT32 strides[] = { img->stride[0], img->stride[1], img->stride[2] };
631 WLog_Print(av1->log, WLOG_ERROR,
"primitives_get(): nullptr");
637 case AOM_IMG_FMT_I420:
638 rec = primitives->YUV420ToRGB_8u_P3AC4R(pSrc, strides, pDstData, nDstStep,
641 case AOM_IMG_FMT_I444:
642 rec = primitives->YUV444ToRGB_8u_P3AC4R(pSrc, strides, pDstData, nDstStep,
646 WLog_Print(av1->log, WLOG_ERROR,
"img->fmt %d not supported", img->fmt);
652 WLog_Print(av1->log, WLOG_ERROR,
"RGB to YUV conversion failed: %d", rec);
661BOOL freerdp_av1_context_reset(FREERDP_AV1_CONTEXT* av1, UINT32 width, UINT32 height)
665#if defined(WITH_LIBAOM)
666 av1->ecfg.g_w = width;
667 av1->ecfg.g_h = height;
669 if (av1->initialized)
671 const aom_codec_err_t rc = aom_codec_destroy(&av1->ctx);
672 av1->initialized =
false;
673 if (rc != AOM_CODEC_OK)
675 WLog_Print(av1->log, WLOG_WARN,
"aom_codec_destroy: %s",
676 aom_codec_err_to_string(rc));
681 const aom_codec_err_t rc =
682 aom_codec_enc_init(&av1->ctx, av1->iface, &av1->ecfg, av1->flags);
683 if (rc != AOM_CODEC_OK)
685 WLog_Print(av1->log, WLOG_WARN,
"aom_codec_enc_init: %s", aom_codec_err_to_string(rc));
691 av1->initialized =
true;
693 WLog_Print(av1->log, WLOG_ERROR,
694 "AV1 encoder requires libaom, recompile with '-DWITH_AOM=ON'");
700#if defined(WITH_DAV1D)
701 if (av1->initialized)
703 dav1d_close(&av1->dav1d);
704 av1->initialized =
false;
707 Dav1dSettings settings = WINPR_C_ARRAY_INIT;
708 dav1d_default_settings(&settings);
711 settings.n_threads = 1;
712 settings.max_frame_delay = 1;
714 const int rc = dav1d_open(&av1->dav1d, &settings);
717 WLog_Print(av1->log, WLOG_WARN,
"dav1d_open: %d", rc);
720 av1->initialized =
true;
721#elif defined(WITH_LIBAOM)
723 av1->dcfg.h = height;
724 av1->dcfg.allow_lowbitdepth = 1;
725 const aom_codec_err_t rc =
726 aom_codec_dec_init(&av1->ctx, av1->iface, &av1->dcfg, av1->flags);
727 if (rc != AOM_CODEC_OK)
729 WLog_Print(av1->log, WLOG_WARN,
"aom_codec_dec_init: %s", aom_codec_err_to_string(rc));
732 av1->initialized =
true;
734 WLog_Print(av1->log, WLOG_WARN,
735 "This build does not support AV1 decoding. Recompile with '-DWITH_DAV1D=ON' "
736 "or '-DWITH_AOM=ON'");
741 av1->yuvWidth = width;
742 av1->yuvStride[0] = width;
744 const size_t pad = av1->yuvStride[0] % 16;
746 av1->yuvStride[0] += 16 - pad;
747 av1->yuvStride[0] *= 3;
748 av1->yuvStride[1] = width;
749 av1->yuvStride[2] = width;
751 av1->yuvHeight = height;
752 winpr_aligned_free(av1->yuvdata[0]);
753 winpr_aligned_free(av1->yuvdata[1]);
754 winpr_aligned_free(av1->yuvdata[2]);
755 av1->yuvdata[0] = winpr_aligned_malloc(1ull * av1->yuvStride[0] * av1->yuvHeight, 64);
756 av1->yuvdata[1] = winpr_aligned_malloc(1ull * av1->yuvStride[1] * av1->yuvHeight, 64);
757 av1->yuvdata[2] = winpr_aligned_malloc(1ull * av1->yuvStride[2] * av1->yuvHeight, 64);
758 return av1->yuvdata[0] !=
nullptr;
761void freerdp_av1_context_free(FREERDP_AV1_CONTEXT* av1)
766 if (av1->initialized)
770#if defined(WITH_LIBAOM)
771 av1_aom_destroy(av1);
776#if defined(WITH_DAV1D)
777 dav1d_close(&av1->dav1d);
778#elif defined(WITH_LIBAOM)
779 av1_aom_destroy(av1);
783 winpr_aligned_free(av1->yuvdata[0]);
784 winpr_aligned_free(av1->yuvdata[1]);
785 winpr_aligned_free(av1->yuvdata[2]);
789FREERDP_AV1_CONTEXT* freerdp_av1_context_new(BOOL Compressor)
791 FREERDP_AV1_CONTEXT* ctx = calloc(1,
sizeof(FREERDP_AV1_CONTEXT));
794 ctx->encoder = Compressor;
795 ctx->log = WLog_Get(TAG);
801#if defined(WITH_LIBAOM)
802 ctx->iface = aom_codec_av1_cx();
805 WLog_Print(ctx->log, WLOG_ERROR,
"aom_codec_av1_cx() nullptr");
809 const aom_codec_err_t rc =
810 aom_codec_enc_config_default(ctx->iface, &ctx->ecfg, AOM_USAGE_REALTIME);
811 if (rc != AOM_CODEC_OK)
813 WLog_Print(ctx->log, WLOG_ERROR,
"aom_codec_enc_config_default() %s",
814 aom_codec_err_to_string(rc));
818 WLog_Print(ctx->log, WLOG_ERROR,
819 "AV1 encoder requires libaom, recompile with '-DWITH_AOM=ON'");
823#if defined(WITH_LIBAOM) && !defined(WITH_DAV1D)
826 ctx->iface = aom_codec_av1_dx();
829 WLog_Print(ctx->log, WLOG_ERROR,
"aom_codec_av1_dx() nullptr");
838 freerdp_av1_context_free(ctx);
843struct S_FREERDP_AV1_CONTEXT
849BOOL freerdp_av1_context_set_option(WINPR_ATTR_UNUSED FREERDP_AV1_CONTEXT* av1,
850 WINPR_ATTR_UNUSED FREERDP_AV1_CONTEXT_OPTION option,
851 WINPR_ATTR_UNUSED UINT32 value)
856UINT32 freerdp_av1_context_get_option(WINPR_ATTR_UNUSED FREERDP_AV1_CONTEXT* av1,
857 WINPR_ATTR_UNUSED FREERDP_AV1_CONTEXT_OPTION option)
862INT32 freerdp_av1_compress(WINPR_ATTR_UNUSED FREERDP_AV1_CONTEXT* av1,
863 WINPR_ATTR_UNUSED
const BYTE* pSrcData,
864 WINPR_ATTR_UNUSED DWORD SrcFormat, WINPR_ATTR_UNUSED UINT32 nSrcStep,
865 WINPR_ATTR_UNUSED UINT32 nSrcWidth, WINPR_ATTR_UNUSED UINT32 nSrcHeight,
867 WINPR_ATTR_UNUSED BYTE** ppDstData, WINPR_ATTR_UNUSED UINT32* pDstSize,
871 WLog_Print(av1->log, WLOG_ERROR,
872 "This build does not support AV1 codec. Recompile with '-DWITH_AOM=ON' or "
873 "'-DWITH_DAV1D=ON'");
877INT32 freerdp_av1_decompress(WINPR_ATTR_UNUSED FREERDP_AV1_CONTEXT* av1,
878 WINPR_ATTR_UNUSED
const BYTE* pSrcData,
879 WINPR_ATTR_UNUSED UINT32 SrcSize, WINPR_ATTR_UNUSED BYTE* pDstData,
880 WINPR_ATTR_UNUSED DWORD DstFormat, WINPR_ATTR_UNUSED UINT32 nDstStep,
881 WINPR_ATTR_UNUSED UINT32 nDstWidth,
882 WINPR_ATTR_UNUSED UINT32 nDstHeight,
884 WINPR_ATTR_UNUSED UINT32 numRegionRect)
887 WLog_Print(av1->log, WLOG_ERROR,
888 "This build does not support AV1 codec. Recompile with '-DWITH_AOM=ON' or "
889 "'-DWITH_DAV1D=ON'");
893BOOL freerdp_av1_context_reset(WINPR_ATTR_UNUSED FREERDP_AV1_CONTEXT* av1,
894 WINPR_ATTR_UNUSED UINT32 width, WINPR_ATTR_UNUSED UINT32 height)
897 WLog_Print(av1->log, WLOG_WARN,
898 "This build does not support AV1 codec. Recompile with '-DWITH_AOM=ON' or "
899 "'-DWITH_DAV1D=ON'");
903void freerdp_av1_context_free(WINPR_ATTR_UNUSED FREERDP_AV1_CONTEXT* av1)
908FREERDP_AV1_CONTEXT* freerdp_av1_context_new(BOOL Compressor)
910 FREERDP_AV1_CONTEXT* ctx = calloc(1,
sizeof(FREERDP_AV1_CONTEXT));
913 ctx->Compressor = Compressor;
914 ctx->log = WLog_Get(TAG);
WINPR_ATTR_NODISCARD fn_RGBToYUV444_8u_P3AC4R_t RGBToI444_8u