History

libaomenc: enable 8, 10 and 12 bit RGB encoding

RGB pixel formats are one occasion where by pixel format we mean pixel format, primaries, transfer characteristic, and matrix coeffs, so we have to manually set them as they're set to unspecified by default, despite there only being a single possible combination.

Lynne committed 6 years ago

Commit 6a2f3f61 parent dabac261 file · +21 −5Browse files

Unified · Split

libavcodec/libaomenc.c+21−5
@@ -310,6 +310,7 @@ static int set_pix_fmt(AVCodecContext *avctx, aom_codec_caps_t codec_caps, · 309 unmodified lines
310 *img_fmt = AOM_IMG_FMT_I422;310 *img_fmt = AOM_IMG_FMT_I422;
311 return 0;311 return 0;
312 case AV_PIX_FMT_YUV444P:312 case AV_PIX_FMT_YUV444P:
313 case AV_PIX_FMT_GBRP:
313 enccfg->g_profile = FF_PROFILE_AV1_HIGH;314 enccfg->g_profile = FF_PROFILE_AV1_HIGH;
314 *img_fmt = AOM_IMG_FMT_I444;315 *img_fmt = AOM_IMG_FMT_I444;
315 return 0;316 return 0;
@@ -338,9 +339,13 @@ static int set_pix_fmt(AVCodecContext *avctx, aom_codec_caps_t codec_caps, · 22 unmodified lines
338 break;339 break;
339 case AV_PIX_FMT_YUV444P10:340 case AV_PIX_FMT_YUV444P10:
340 case AV_PIX_FMT_YUV444P12:341 case AV_PIX_FMT_YUV444P12:
342 case AV_PIX_FMT_GBRP10:
343 case AV_PIX_FMT_GBRP12:
341 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {344 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {
342 enccfg->g_bit_depth = enccfg->g_input_bit_depth =345 enccfg->g_bit_depth = enccfg->g_input_bit_depth = 10;
343 avctx->pix_fmt == AV_PIX_FMT_YUV444P10 ? 10 : 12;346 if (avctx->pix_fmt == AV_PIX_FMT_YUV444P12 ||
347 avctx->pix_fmt == AV_PIX_FMT_GBRP12)
348 enccfg->g_bit_depth = enccfg->g_input_bit_depth = 12;
344 enccfg->g_profile =349 enccfg->g_profile =
345 enccfg->g_bit_depth == 10 ? FF_PROFILE_AV1_HIGH : FF_PROFILE_AV1_PROFESSIONAL;350 enccfg->g_bit_depth == 10 ? FF_PROFILE_AV1_HIGH : FF_PROFILE_AV1_PROFESSIONAL;
346 *img_fmt = AOM_IMG_FMT_I44416;351 *img_fmt = AOM_IMG_FMT_I44416;
@@ -749,9 +754,16 @@ static av_cold int aom_init(AVCodecContext *avctx, · 402 unmodified lines
749 if (ctx->tune >= 0)754 if (ctx->tune >= 0)
750 codecctl_int(avctx, AOME_SET_TUNING, ctx->tune);755 codecctl_int(avctx, AOME_SET_TUNING, ctx->tune);
751 756
752 codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries);757 if (avctx->pix_fmt == AV_PIX_FMT_GBRP || avctx->pix_fmt == AV_PIX_FMT_GBRP10 ||
753 codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);758 avctx->pix_fmt == AV_PIX_FMT_GBRP12) {
754 codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, avctx->color_trc);759 codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, AVCOL_PRI_BT709);
760 codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, AVCOL_SPC_RGB);
761 codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, AVCOL_TRC_IEC61966_2_1);
762 } else {
763 codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries);
764 codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);
765 codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, avctx->color_trc);
766 }
755 if (ctx->aq_mode >= 0)767 if (ctx->aq_mode >= 0)
756 codecctl_int(avctx, AV1E_SET_AQ_MODE, ctx->aq_mode);768 codecctl_int(avctx, AV1E_SET_AQ_MODE, ctx->aq_mode);
757 if (ctx->frame_parallel >= 0)769 if (ctx->frame_parallel >= 0)
@@ -1077,6 +1089,7 @@ static const enum AVPixelFormat av1_pix_fmts[] = { · 319 unmodified lines
1077 AV_PIX_FMT_YUV420P,1089 AV_PIX_FMT_YUV420P,
1078 AV_PIX_FMT_YUV422P,1090 AV_PIX_FMT_YUV422P,
1079 AV_PIX_FMT_YUV444P,1091 AV_PIX_FMT_YUV444P,
1092 AV_PIX_FMT_GBRP,
1080 AV_PIX_FMT_NONE1093 AV_PIX_FMT_NONE
1081};1094};
1082 1095
@@ -1084,12 +1097,15 @@ static const enum AVPixelFormat av1_pix_fmts_highbd[] = { · 1 unmodified line
1084 AV_PIX_FMT_YUV420P,1097 AV_PIX_FMT_YUV420P,
1085 AV_PIX_FMT_YUV422P,1098 AV_PIX_FMT_YUV422P,
1086 AV_PIX_FMT_YUV444P,1099 AV_PIX_FMT_YUV444P,
1100 AV_PIX_FMT_GBRP,
1087 AV_PIX_FMT_YUV420P10,1101 AV_PIX_FMT_YUV420P10,
1088 AV_PIX_FMT_YUV422P10,1102 AV_PIX_FMT_YUV422P10,
1089 AV_PIX_FMT_YUV444P10,1103 AV_PIX_FMT_YUV444P10,
1090 AV_PIX_FMT_YUV420P12,1104 AV_PIX_FMT_YUV420P12,
1091 AV_PIX_FMT_YUV422P12,1105 AV_PIX_FMT_YUV422P12,
1092 AV_PIX_FMT_YUV444P12,1106 AV_PIX_FMT_YUV444P12,
1107 AV_PIX_FMT_GBRP10,
1108 AV_PIX_FMT_GBRP12,
1093 AV_PIX_FMT_NONE1109 AV_PIX_FMT_NONE
1094};1110};
1095 1111

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t