diff mbox

[FFmpeg-devel] lavc/libaomenc: Support lossless encoding

Message ID CAB0OVGr6o6yR3bVAgJix7R7mZCRRVruw=jqA7wGJb+hQ2BvZUQ@mail.gmail.com
State New
Headers show

Commit Message

Carl Eugen Hoyos Jan. 10, 2019, 8:58 p.m. UTC
Hi!

Attached patch fixes ticket #7600.

Please comment, Carl Eugen

Comments

Rostislav Pehlivanov Jan. 10, 2019, 10:35 p.m. UTC | #1
On Thu, 10 Jan 2019 at 20:59, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:

> Hi!
>
> Attached patch fixes ticket #7600.
>
> Please comment, Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


You can already do that via -b:v 0 -crf 0, same as with libvpx, can't you?
Carl Eugen Hoyos Jan. 10, 2019, 10:48 p.m. UTC | #2
2019-01-10 23:35 GMT+01:00, Rostislav Pehlivanov <atomnuker@gmail.com>:
> On Thu, 10 Jan 2019 at 20:59, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
>> Hi!
>>
>> Attached patch fixes ticket #7600.

> You can already do that via -b:v 0 -crf 0, same as with libvpx, can't you?

Then why does libvpx have an undeprecated option "lossless"?

Carl Eugen
diff mbox

Patch

From 90492e635c461f328a18cb6a55a71206f9cd5aeb Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Thu, 10 Jan 2019 21:56:28 +0100
Subject: [PATCH] lavc/libaomenc: Support lossless encoding.

Tested-by: Ewout ter Hoeven
---
 libavcodec/libaomenc.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index faec61c..244c71a 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -79,6 +79,7 @@  typedef struct AOMEncoderContext {
     aom_superblock_size_t superblock_size;
     int uniform_tiles;
     int row_mt;
+    int lossless;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -96,6 +97,7 @@  static const char *const ctlidstr[] = {
 #ifdef AOM_CTRL_AV1E_SET_ROW_MT
     [AV1E_SET_ROW_MT]           = "AV1E_SET_ROW_MT",
 #endif
+    [AV1E_SET_LOSSLESS]         = "AV1E_SET_LOSSLESS",
 };
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -662,6 +664,7 @@  static av_cold int aom_init(AVCodecContext *avctx,
 #ifdef AOM_CTRL_AV1E_SET_ROW_MT
     codecctl_int(avctx, AV1E_SET_ROW_MT, ctx->row_mt);
 #endif
+    codecctl_int(avctx, AV1E_SET_LOSSLESS, ctx->lossless);
 
     // provide dummy value to initialize wrapper, values will be updated each _encode()
     aom_img_wrap(&ctx->rawimg, img_fmt, avctx->width, avctx->height, 1,
@@ -997,6 +1000,7 @@  static const AVOption options[] = {
     { "tile-columns",     "Log2 of number of tile columns to use", OFFSET(tile_cols_log2), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
     { "tile-rows",        "Log2 of number of tile rows to use",    OFFSET(tile_rows_log2), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
     { "row-mt",           "Enable row based multi-threading",      OFFSET(row_mt),         AV_OPT_TYPE_BOOL, {.i64 = 0},  0, 1, VE},
+    { "lossless",         "Lossless mode",                         OFFSET(lossless),       AV_OPT_TYPE_BOOL, {.i64 = 0},  0, 1, VE},
     { NULL }
 };
 
-- 
1.7.10.4