Am Sa., 20. März 2021 um 19:06 Uhr schrieb James Almer <jamr...@gmail.com>:
>
> On 3/20/2021 2:51 PM, Carl Eugen Hoyos wrote:
> > Hi!
> >
> > Attached patch fixes lossless aom encoding in some cases for me, it is
> > still possible to force lossy encoding with crf == 0 and qmax > 0.
> >
> > Please comment, Carl Eugen
>
>
> > From a7b9b60d7091bbf0af84b8eda8bc84ce858d071e Mon Sep 17 00:00:00 2001
> > From: Carl Eugen Hoyos <ceffm...@gmail.com>
> > Date: Sat, 20 Mar 2021 18:47:52 +0100
> > Subject: [PATCH] lavc/aom: Force default qmax to 0 if crf was set to 0.
>
> libaomenc, not just "aom".

I hope "aomenc" is ok.

New patch attached.

Thank you for the review, Carl Eugen
From 0c77fe4c284c03f55c95ba05757afb3407ce2ff4 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffm...@gmail.com>
Date: Sat, 20 Mar 2021 19:27:48 +0100
Subject: [PATCH] lavc/aomenc: Force default qmax of 0 if crf was set to 0.

Fixes lossless encoding.
---
 libavcodec/libaomenc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 2c3c3eb185..fcf75e835d 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -654,8 +654,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
 
     if (avctx->qmin >= 0)
         enccfg.rc_min_quantizer = avctx->qmin;
-    if (avctx->qmax >= 0)
+    if (avctx->qmax >= 0) {
         enccfg.rc_max_quantizer = avctx->qmax;
+    } else if (!ctx->crf) {
+        enccfg.rc_max_quantizer = 0;
+    }
 
     if (enccfg.rc_end_usage == AOM_CQ || enccfg.rc_end_usage == AOM_Q) {
         if (ctx->crf < enccfg.rc_min_quantizer || ctx->crf > enccfg.rc_max_quantizer) {
-- 
2.30.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to