[FFmpeg-trac] #7599(avcodec:new): Add monochrome/gray pixel format to libaom-av1
FFmpeg
trac at avcodec.org
Fri Dec 7 14:44:14 EET 2018
#7599: Add monochrome/gray pixel format to libaom-av1
-------------------------------------+-----------------------------------
Reporter: Ewout | Owner:
Type: enhancement | Status: new
Priority: wish | Component: avcodec
Version: git-master | Resolution:
Keywords: libaom | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-----------------------------------
Changes (by cehoyos):
* priority: normal => wish
* version: unspecified => git-master
* component: undetermined => avcodec
Comment:
Please test this patch:
{{{
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 1756501..e8dde36 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -231,6 +231,8 @@ static int set_pix_fmt(AVCodecContext *avctx,
aom_codec_caps_t codec_caps,
AOMContext av_unused *ctx = avctx->priv_data;
enccfg->g_bit_depth = enccfg->g_input_bit_depth = 8;
switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_GRAY8:
+ ctx->rawimg.monochrome = 1;
case AV_PIX_FMT_YUV420P:
enccfg->g_profile = FF_PROFILE_AV1_MAIN;
*img_fmt = AOM_IMG_FMT_I420;
@@ -243,11 +245,14 @@ static int set_pix_fmt(AVCodecContext *avctx,
aom_codec_caps_t codec_caps,
enccfg->g_profile = FF_PROFILE_AV1_HIGH;
*img_fmt = AOM_IMG_FMT_I444;
return 0;
+ case AV_PIX_FMT_GRAY10:
+ case AV_PIX_FMT_GRAY12:
+ ctx->rawimg.monochrome = 1;
case AV_PIX_FMT_YUV420P10:
case AV_PIX_FMT_YUV420P12:
if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {
enccfg->g_bit_depth = enccfg->g_input_bit_depth =
- avctx->pix_fmt == AV_PIX_FMT_YUV420P10 ? 10 : 12;
+ avctx->pix_fmt == AV_PIX_FMT_YUV420P10 || avctx->pix_fmt
== AV_PIX_FMT_GRAY10 ? 10 : 12;
enccfg->g_profile =
enccfg->g_bit_depth == 10 ? FF_PROFILE_AV1_MAIN :
FF_PROFILE_AV1_PROFESSIONAL;
*img_fmt = AOM_IMG_FMT_I42016;
@@ -937,6 +942,7 @@ static const enum AVPixelFormat av1_pix_fmts[] = {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_GRAY8,
AV_PIX_FMT_NONE
};
@@ -944,12 +950,15 @@ static const enum AVPixelFormat
av1_pix_fmts_highbd[] = {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_GRAY8,
AV_PIX_FMT_YUV420P10,
AV_PIX_FMT_YUV422P10,
AV_PIX_FMT_YUV444P10,
+ AV_PIX_FMT_GRAY10,
AV_PIX_FMT_YUV420P12,
AV_PIX_FMT_YUV422P12,
AV_PIX_FMT_YUV444P12,
+ AV_PIX_FMT_GRAY12,
AV_PIX_FMT_NONE
};
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7599#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list