Last active
August 23, 2018 17:36
-
-
Save Kagami/8d42f7b9d6c3d7e87a6da40b0fee10dc to your computer and use it in GitHub Desktop.
AV1 patches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 71b9e8a8a10e87047aacf5e340359af16813f978 Mon Sep 17 00:00:00 2001 | |
From: Kagami Hiiragi <[email protected]> | |
Date: Mon, 20 Aug 2018 20:52:52 +0300 | |
Subject: [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows | |
These options are required for multithreaded encoding, because they set | |
to zero by default in av1_cx_iface.c. | |
Signed-off-by: Kagami Hiiragi <[email protected]> | |
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c | |
index 9431179886..55cb7ff72e 100644 | |
--- a/libavcodec/libaomenc.c | |
+++ b/libavcodec/libaomenc.c | |
@@ -68,6 +68,8 @@ typedef struct AOMEncoderContext { | |
int static_thresh; | |
int drop_threshold; | |
int noise_sensitivity; | |
+ int tile_columns; | |
+ int tile_rows; | |
} AOMContext; | |
static const char *const ctlidstr[] = { | |
@@ -75,6 +77,8 @@ static const char *const ctlidstr[] = { | |
[AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL", | |
[AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF", | |
[AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD", | |
+ [AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS", | |
+ [AV1E_SET_TILE_ROWS] = "AV1E_SET_TILE_ROWS", | |
[AV1E_SET_COLOR_RANGE] = "AV1E_SET_COLOR_RANGE", | |
[AV1E_SET_COLOR_PRIMARIES] = "AV1E_SET_COLOR_PRIMARIES", | |
[AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS", | |
@@ -449,6 +453,11 @@ static av_cold int aom_init(AVCodecContext *avctx, | |
if (ctx->crf >= 0) | |
codecctl_int(avctx, AOME_SET_CQ_LEVEL, ctx->crf); | |
+ if (ctx->tile_columns >= 0) | |
+ codecctl_int(avctx, AV1E_SET_TILE_COLUMNS, ctx->tile_columns); | |
+ if (ctx->tile_rows >= 0) | |
+ codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows); | |
+ | |
codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries); | |
codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace); | |
codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, avctx->color_trc); | |
@@ -746,6 +755,8 @@ static const AVOption options[] = { | |
{ "static-thresh", "A change threshold on blocks below which they will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, | |
{ "drop-threshold", "Frame drop threshold", offsetof(AOMContext, drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE }, | |
{ "noise-sensitivity", "Noise sensitivity", OFFSET(noise_sensitivity), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE}, | |
+ { "tile-columns", "Number of tile columns to use, log2", OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE}, | |
+ { "tile-rows", "Number of tile rows to use, log2", OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE}, | |
{ NULL } | |
}; | |
-- | |
2.18.0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From c8a9b62ecce222dab04982ac88519524f992aa01 Mon Sep 17 00:00:00 2001 | |
From: Kagami Hiiragi <[email protected]> | |
Date: Mon, 20 Aug 2018 19:27:55 +0300 | |
Subject: [PATCH] lavf/matroska: Allow AV1 in WebM | |
Nothing prevents it to work except this check. AV1 is already supported | |
by Matroska muxer and aomenc produces WebM/AV1 files as well. | |
Signed-off-by: Kagami Hiiragi <[email protected]> | |
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c | |
index 09a62e1922..76cb124221 100644 | |
--- a/libavformat/matroskaenc.c | |
+++ b/libavformat/matroskaenc.c | |
@@ -1296,11 +1296,12 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, | |
if (mkv->mode == MODE_WEBM && !(par->codec_id == AV_CODEC_ID_VP8 || | |
par->codec_id == AV_CODEC_ID_VP9 || | |
+ par->codec_id == AV_CODEC_ID_AV1 || | |
par->codec_id == AV_CODEC_ID_OPUS || | |
par->codec_id == AV_CODEC_ID_VORBIS || | |
par->codec_id == AV_CODEC_ID_WEBVTT)) { | |
av_log(s, AV_LOG_ERROR, | |
- "Only VP8 or VP9 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n"); | |
+ "Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n"); | |
return AVERROR(EINVAL); | |
} | |
-- | |
2.18.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment