1 /*
2 * Copyright (c) 2010, Google, Inc.
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /**
22 * @file
23 * AV1 encoder support via libaom
24 */
25
27
28 #define AOM_DISABLE_CTRL_TYPECHECKS 1
29 #include <aom/aom_encoder.h>
30 #include <aom/aomcx.h>
31
42
55
56 /*
57 * Portion of struct aom_codec_cx_pkt from aom_encoder.h.
58 * One encoded frame returned from the library.
59 */
61 void *
buf;
/**< compressed data buffer */
62 size_t sz;
/**< length of compressed data */
64 (in timebase units) */
65 unsigned long duration;
/**< duration to show frame
66 (in timebase units) */
67 uint32_t
flags;
/**< flags for this frame */
69 int have_sse;
/**< true if we have pending sse[] */
72 };
73
96 int have_sse;
/**< true if we have pending sse[] */
144 } AOMContext;
145
146 #define OFFSET(x) offsetof(AOMContext, x)
147
149 [AOME_SET_CPUUSED] = "AOME_SET_CPUUSED",
150 [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
151 [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
152 [AOME_SET_ARNR_MAXFRAMES] = "AOME_SET_ARNR_MAXFRAMES",
153 [AOME_SET_ARNR_STRENGTH] = "AOME_SET_ARNR_STRENGTH",
154 [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
155 [AV1E_SET_COLOR_RANGE] = "AV1E_SET_COLOR_RANGE",
156 [AV1E_SET_COLOR_PRIMARIES] = "AV1E_SET_COLOR_PRIMARIES",
157 [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
158 [AV1E_SET_TRANSFER_CHARACTERISTICS] = "AV1E_SET_TRANSFER_CHARACTERISTICS",
159 [AV1E_SET_AQ_MODE] = "AV1E_SET_AQ_MODE",
160 [AV1E_SET_FRAME_PARALLEL_DECODING] = "AV1E_SET_FRAME_PARALLEL_DECODING",
161 [AV1E_SET_SUPERBLOCK_SIZE] = "AV1E_SET_SUPERBLOCK_SIZE",
162 [AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
163 [AV1E_SET_TILE_ROWS] = "AV1E_SET_TILE_ROWS",
164 [AV1E_SET_ENABLE_RESTORATION] = "AV1E_SET_ENABLE_RESTORATION",
165 [AV1E_SET_ROW_MT] = "AV1E_SET_ROW_MT",
166 [AV1E_SET_DENOISE_NOISE_LEVEL] = "AV1E_SET_DENOISE_NOISE_LEVEL",
167 [AV1E_SET_DENOISE_BLOCK_SIZE] = "AV1E_SET_DENOISE_BLOCK_SIZE",
168 [AV1E_SET_MAX_REFERENCE_FRAMES] = "AV1E_SET_MAX_REFERENCE_FRAMES",
169 [AV1E_SET_ENABLE_GLOBAL_MOTION] = "AV1E_SET_ENABLE_GLOBAL_MOTION",
170 [AV1E_SET_ENABLE_INTRABC] = "AV1E_SET_ENABLE_INTRABC",
171 [AV1E_SET_ENABLE_CDEF] = "AV1E_SET_ENABLE_CDEF",
172 [AOME_SET_TUNING] = "AOME_SET_TUNING",
173 [AV1E_SET_ENABLE_1TO4_PARTITIONS] = "AV1E_SET_ENABLE_1TO4_PARTITIONS",
174 [AV1E_SET_ENABLE_AB_PARTITIONS] = "AV1E_SET_ENABLE_AB_PARTITIONS",
175 [AV1E_SET_ENABLE_RECT_PARTITIONS] = "AV1E_SET_ENABLE_RECT_PARTITIONS",
176 [AV1E_SET_ENABLE_ANGLE_DELTA] = "AV1E_SET_ENABLE_ANGLE_DELTA",
177 [AV1E_SET_ENABLE_CFL_INTRA] = "AV1E_SET_ENABLE_CFL_INTRA",
178 [AV1E_SET_ENABLE_FILTER_INTRA] = "AV1E_SET_ENABLE_FILTER_INTRA",
179 [AV1E_SET_ENABLE_INTRA_EDGE_FILTER] = "AV1E_SET_ENABLE_INTRA_EDGE_FILTER",
180 [AV1E_SET_ENABLE_PAETH_INTRA] = "AV1E_SET_ENABLE_PAETH_INTRA",
181 [AV1E_SET_ENABLE_SMOOTH_INTRA] = "AV1E_SET_ENABLE_SMOOTH_INTRA",
182 [AV1E_SET_ENABLE_PALETTE] = "AV1E_SET_ENABLE_PALETTE",
183 [AV1E_SET_ENABLE_FLIP_IDTX] = "AV1E_SET_ENABLE_FLIP_IDTX",
184 [AV1E_SET_ENABLE_TX64] = "AV1E_SET_ENABLE_TX64",
185 [AV1E_SET_INTRA_DCT_ONLY] = "AV1E_SET_INTRA_DCT_ONLY",
186 [AV1E_SET_INTER_DCT_ONLY] = "AV1E_SET_INTER_DCT_ONLY",
187 [AV1E_SET_INTRA_DEFAULT_TX_ONLY] = "AV1E_SET_INTRA_DEFAULT_TX_ONLY",
188 [AV1E_SET_REDUCED_TX_TYPE_SET] = "AV1E_SET_REDUCED_TX_TYPE_SET",
189 [AV1E_SET_ENABLE_DIFF_WTD_COMP] = "AV1E_SET_ENABLE_DIFF_WTD_COMP",
190 [AV1E_SET_ENABLE_DIST_WTD_COMP] = "AV1E_SET_ENABLE_DIST_WTD_COMP",
191 [AV1E_SET_ENABLE_DUAL_FILTER] = "AV1E_SET_ENABLE_DUAL_FILTER",
192 [AV1E_SET_ENABLE_INTERINTER_WEDGE] = "AV1E_SET_ENABLE_INTERINTER_WEDGE",
193 [AV1E_SET_ENABLE_INTERINTRA_WEDGE] = "AV1E_SET_ENABLE_INTERINTRA_WEDGE",
194 [AV1E_SET_ENABLE_MASKED_COMP] = "AV1E_SET_ENABLE_MASKED_COMP",
195 [AV1E_SET_ENABLE_INTERINTRA_COMP] = "AV1E_SET_ENABLE_INTERINTRA_COMP",
196 [AV1E_SET_ENABLE_OBMC] = "AV1E_SET_ENABLE_OBMC",
197 [AV1E_SET_ENABLE_ONESIDED_COMP] = "AV1E_SET_ENABLE_ONESIDED_COMP",
198 [AV1E_SET_REDUCED_REFERENCE_SET] = "AV1E_SET_REDUCED_REFERENCE_SET",
199 [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
200 [AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
201 #ifdef AOM_CTRL_AV1E_GET_NUM_OPERATING_POINTS
202 [AV1E_GET_NUM_OPERATING_POINTS] = "AV1E_GET_NUM_OPERATING_POINTS",
203 #endif
204 [AV1E_GET_SEQ_LEVEL_IDX] = "AV1E_GET_SEQ_LEVEL_IDX",
205 #ifdef AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX
206 [AV1E_GET_TARGET_SEQ_LEVEL_IDX] = "AV1E_GET_TARGET_SEQ_LEVEL_IDX",
207 #endif
208 [AV1_GET_NEW_FRAME_IMAGE] = "AV1_GET_NEW_FRAME_IMAGE",
209 };
210
212 {
214 const char *
error = aom_codec_error(&
ctx->encoder);
215 const char *detail = aom_codec_error_detail(&
ctx->encoder);
216
218 if (detail)
220 }
221
223 const struct aom_codec_enc_cfg *cfg,
225 {
227
230 " %*s%u\n %*s%u\n %*s%u\n %*s%u\n %*s%u\n"
231 " %*s%u\n %*s%u\n"
232 " %*s{%u/%u}\n %*s%u\n %*s%d\n %*s%u\n",
233 width,
"g_usage:", cfg->g_usage,
234 width,
"g_threads:", cfg->g_threads,
235 width,
"g_profile:", cfg->g_profile,
236 width,
"g_w:", cfg->g_w,
237 width,
"g_h:", cfg->g_h,
238 width,
"g_bit_depth:", cfg->g_bit_depth,
239 width,
"g_input_bit_depth:", cfg->g_input_bit_depth,
240 width,
"g_timebase:", cfg->g_timebase.num, cfg->g_timebase.den,
241 width,
"g_error_resilient:", cfg->g_error_resilient,
242 width,
"g_pass:", cfg->g_pass,
243 width,
"g_lag_in_frames:", cfg->g_lag_in_frames);
246 width,
"rc_dropframe_thresh:", cfg->rc_dropframe_thresh,
247 width,
"rc_end_usage:", cfg->rc_end_usage,
248 width,
"rc_twopass_stats_in:", cfg->rc_twopass_stats_in.buf, cfg->rc_twopass_stats_in.sz,
249 width,
"rc_target_bitrate:", cfg->rc_target_bitrate);
251 " %*s%u\n %*s%u\n",
252 width,
"rc_min_quantizer:", cfg->rc_min_quantizer,
253 width,
"rc_max_quantizer:", cfg->rc_max_quantizer);
255 " %*s%u\n %*s%u\n",
256 width,
"rc_undershoot_pct:", cfg->rc_undershoot_pct,
257 width,
"rc_overshoot_pct:", cfg->rc_overshoot_pct);
259 " %*s%u\n %*s%u\n %*s%u\n",
260 width,
"rc_buf_sz:", cfg->rc_buf_sz,
261 width,
"rc_buf_initial_sz:", cfg->rc_buf_initial_sz,
262 width,
"rc_buf_optimal_sz:", cfg->rc_buf_optimal_sz);
263 av_log(avctx,
level,
"2 pass rate control settings\n"
264 " %*s%u\n %*s%u\n %*s%u\n",
265 width,
"rc_2pass_vbr_bias_pct:", cfg->rc_2pass_vbr_bias_pct,
266 width,
"rc_2pass_vbr_minsection_pct:", cfg->rc_2pass_vbr_minsection_pct,
267 width,
"rc_2pass_vbr_maxsection_pct:", cfg->rc_2pass_vbr_maxsection_pct);
269 " %*s%d\n %*s%u\n %*s%u\n",
270 width,
"kf_mode:", cfg->kf_mode,
271 width,
"kf_min_dist:", cfg->kf_min_dist,
272 width,
"kf_max_dist:", cfg->kf_max_dist);
274 " %*s%d\n %*s%d\n",
275 width,
"tile_width_count:", cfg->tile_width_count,
276 width,
"tile_height_count:", cfg->tile_height_count);
278 }
279
281 {
283
288 }
289
291 {
294 }
295
297 {
299
304 }
305 }
306
308 #ifdef UENUM1BYTE
309 aome_enc_control_id id,
310 #else
311 enum aome_enc_control_id id,
312 #endif
314 {
318 int res;
319
322
323 res = aom_codec_control(&
ctx->encoder,
id,
val);
324 if (res != AOM_CODEC_OK) {
329 }
330
331 return 0;
332 }
333
335 {
336 // Check for HDR10+
339 if (!side_data)
340 return 0;
341
342 size_t payload_size;
345 if (res < 0) {
347 return res;
348 }
349
350 uint8_t *hdr_plus_buf;
351 // Extra bytes for the country code, provider code, provider oriented code and app id.
352 const size_t hdr_plus_buf_size = payload_size + 6;
353 hdr_plus_buf =
av_malloc(hdr_plus_buf_size);
354 if (!hdr_plus_buf)
356
357 uint8_t *payload = hdr_plus_buf;
358 // See "HDR10+ AV1 Metadata Handling Specification" v1.0.1, Section 2.1.
361 bytestream_put_be16(&payload, 0x0001); // provider_oriented_code
362 bytestream_put_byte(&payload, 0x04); // application_identifier
363
365 if (res < 0) {
368 return res;
369 }
370
371 res = aom_img_add_metadata(
img, OBU_METADATA_TYPE_ITUT_T35,
372 hdr_plus_buf, hdr_plus_buf_size, AOM_MIF_ANY_FRAME);
374 if (res < 0) {
376 return res;
377 }
378 return 0;
379 }
380
381 #if defined(AOM_CTRL_AV1E_GET_NUM_OPERATING_POINTS) && \
382 defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
383 defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
385 #ifdef UENUM1BYTE
386 aome_enc_control_id id,
387 #else
388 enum aome_enc_control_id id,
389 #endif
390 int* ptr)
391 {
395 int res;
396
399
400 res = aom_codec_control(&
ctx->encoder,
id, ptr);
401 if (res != AOM_CODEC_OK) {
406 }
407
408 return 0;
409 }
410 #endif
411
413 #ifdef UENUM1BYTE
414 aome_enc_control_id id,
415 #else
416 enum aome_enc_control_id id,
417 #endif
418 struct aom_image *
img)
419 {
422 int res;
423
425
426 res = aom_codec_control(&
ctx->encoder,
id,
img);
427 if (res != AOM_CODEC_OK) {
432 }
433
434 return 0;
435 }
436
438 {
440
441 #if defined(AOM_CTRL_AV1E_GET_NUM_OPERATING_POINTS) && \
442 defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
443 defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
445 int num_operating_points;
446 int levels[32];
447 int target_levels[32];
448
449 if (!codecctl_intp(avctx, AV1E_GET_NUM_OPERATING_POINTS,
450 &num_operating_points) &&
451 !codecctl_intp(avctx, AV1E_GET_SEQ_LEVEL_IDX, levels) &&
452 !codecctl_intp(avctx, AV1E_GET_TARGET_SEQ_LEVEL_IDX,
453 target_levels)) {
454 for (
int i = 0;
i < num_operating_points;
i++) {
455 if (levels[
i] > target_levels[
i]) {
456 // Warn when the target level was not met
458 "Could not encode to target level %d.%d for "
459 "operating point %d. The output level is %d.%d.\n",
460 2 + (target_levels[
i] >> 2), target_levels[
i] & 3,
461 i, 2 + (levels[
i] >> 2), levels[
i] & 3);
462 }
else if (target_levels[
i] < 31) {
463 // Log the encoded level if a target level was given
465 "Output level for operating point %d is %d.%d.\n",
466 i, 2 + (levels[
i] >> 2), levels[
i] & 3);
467 }
468 }
469 }
470 }
471 #endif
472
473 aom_codec_destroy(&
ctx->encoder);
474 aom_img_remove_metadata(&
ctx->rawimg);
480 return 0;
481 }
482
484 struct aom_codec_enc_cfg *enccfg, aom_codec_flags_t *
flags,
485 aom_img_fmt_t *img_fmt)
486 {
489 enccfg->g_bit_depth = enccfg->g_input_bit_depth =
desc->comp[0].depth;
492 enccfg->monochrome = 1;
493 /* Fall-through */
496 *img_fmt = AOM_IMG_FMT_I420;
497 return 0;
500 *img_fmt = AOM_IMG_FMT_I422;
501 return 0;
505 *img_fmt = AOM_IMG_FMT_I444;
506 return 0;
509 enccfg->monochrome = 1;
510 /* Fall-through */
513 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {
514 enccfg->g_profile =
516 *img_fmt = AOM_IMG_FMT_I42016;
517 *
flags |= AOM_CODEC_USE_HIGHBITDEPTH;
518 return 0;
519 }
520 break;
523 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {
525 *img_fmt = AOM_IMG_FMT_I42216;
526 *
flags |= AOM_CODEC_USE_HIGHBITDEPTH;
527 return 0;
528 }
529 break;
534 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {
535 enccfg->g_profile =
537 *img_fmt = AOM_IMG_FMT_I44416;
538 *
flags |= AOM_CODEC_USE_HIGHBITDEPTH;
539 return 0;
540 }
541 break;
542 default:
543 break;
544 }
547 }
548
550 {
551 aom_color_range_t aom_cr;
556 default:
559 return;
560 }
561
563 }
564
566 {
567 int sb_dim = (
dim + sb_size - 1) / sb_size;
568 int tile_dim = (sb_dim + (1 << tiles_log2) - 1) >> tiles_log2;
570 return (sb_dim + tile_dim - 1) / tile_dim;
571 }
572
574 struct aom_codec_enc_cfg *enccfg)
575 {
577 int sb_128x128_possible, sb_size, sb_width, sb_height;
578 int uniform_rows, uniform_cols;
579 int uniform_64x64_possible, uniform_128x128_possible;
580 int tile_size, rounding,
i;
581
582 if (
ctx->tile_cols_log2 >= 0)
583 ctx->tile_cols = 1 <<
ctx->tile_cols_log2;
584 if (
ctx->tile_rows_log2 >= 0)
585 ctx->tile_rows = 1 <<
ctx->tile_rows_log2;
586
587 if (
ctx->tile_cols == 0) {
590 if (
ctx->tile_cols > 1) {
592 "columns to fill width.\n",
ctx->tile_cols);
593 }
594 }
596 if (
ctx->tile_rows == 0) {
597 int max_tile_width =
599 ctx->tile_cols - 1) /
ctx->tile_cols, 128);
603 if (
ctx->tile_rows > 1) {
605 "rows to fill area.\n",
ctx->tile_rows);
606 }
607 }
609
610 if ((avctx->
width + 63) / 64 <
ctx->tile_cols ||
611 (avctx->
height + 63) / 64 <
ctx->tile_rows) {
613 "large enough to fit specified tile arrangement.\n");
615 }
619 "not allow more than %dx%d tiles.\n",
622 }
625 "not allow tiles of width greater than %d.\n",
628 }
629
630 ctx->superblock_size = AOM_SUPERBLOCK_SIZE_DYNAMIC;
631
632 if (
ctx->tile_cols == 1 &&
ctx->tile_rows == 1) {
634 return 0;
635 }
636
637 sb_128x128_possible =
638 (avctx->
width + 127) / 128 >=
ctx->tile_cols &&
639 (avctx->
height + 127) / 128 >=
ctx->tile_rows;
640
641 ctx->tile_cols_log2 =
ctx->tile_cols == 1 ? 0 :
643 ctx->tile_rows_log2 =
ctx->tile_rows == 1 ? 0 :
645
647 64,
ctx->tile_cols_log2);
649 64,
ctx->tile_rows_log2);
651 "-> %dx%d tiles.\n", uniform_cols, uniform_rows);
652 uniform_64x64_possible = uniform_cols ==
ctx->tile_cols &&
653 uniform_rows ==
ctx->tile_rows;
654
655 if (sb_128x128_possible) {
657 128,
ctx->tile_cols_log2);
659 128,
ctx->tile_rows_log2);
661 "-> %dx%d tiles.\n", uniform_cols, uniform_rows);
662 uniform_128x128_possible = uniform_cols ==
ctx->tile_cols &&
663 uniform_rows ==
ctx->tile_rows;
664 } else {
666 uniform_128x128_possible = 0;
667 }
668
669 ctx->uniform_tiles = 1;
670 if (uniform_64x64_possible && uniform_128x128_possible) {
672 "superblocks (tile_cols_log2 = %d, tile_rows_log2 = %d).\n",
673 ctx->tile_cols_log2,
ctx->tile_rows_log2);
674 return 0;
675 }
676 if (uniform_64x64_possible && !sb_128x128_possible) {
678 "superblocks (tile_cols_log2 = %d, tile_rows_log2 = %d).\n",
679 ctx->tile_cols_log2,
ctx->tile_rows_log2);
680 ctx->superblock_size = AOM_SUPERBLOCK_SIZE_64X64;
681 return 0;
682 }
683 if (uniform_128x128_possible) {
685 "superblocks (tile_cols_log2 = %d, tile_rows_log2 = %d).\n",
686 ctx->tile_cols_log2,
ctx->tile_rows_log2);
687 ctx->superblock_size = AOM_SUPERBLOCK_SIZE_128X128;
688 return 0;
689 }
690 ctx->uniform_tiles = 0;
691
692 if (sb_128x128_possible) {
693 sb_size = 128;
694 ctx->superblock_size = AOM_SUPERBLOCK_SIZE_128X128;
695 } else {
696 sb_size = 64;
697 ctx->superblock_size = AOM_SUPERBLOCK_SIZE_64X64;
698 }
700 "superblocks (tile_cols = %d, tile_rows = %d).\n",
701 sb_size, sb_size,
ctx->tile_cols,
ctx->tile_rows);
702
703 enccfg->tile_width_count =
ctx->tile_cols;
704 enccfg->tile_height_count =
ctx->tile_rows;
705
706 sb_width = (avctx->
width + sb_size - 1) / sb_size;
707 sb_height = (avctx->
height + sb_size - 1) / sb_size;
708
709 tile_size = sb_width /
ctx->tile_cols;
710 rounding = sb_width %
ctx->tile_cols;
711 for (
i = 0;
i <
ctx->tile_cols;
i++) {
712 enccfg->tile_widths[
i] = tile_size +
714 i >
ctx->tile_cols - 1 - (rounding + 1) / 2);
715 }
716
717 tile_size = sb_height /
ctx->tile_rows;
718 rounding = sb_height %
ctx->tile_rows;
719 for (
i = 0;
i <
ctx->tile_rows;
i++) {
720 enccfg->tile_heights[
i] = tile_size +
722 i >
ctx->tile_rows - 1 - (rounding + 1) / 2);
723 }
724
725 return 0;
726 }
727
728
729 static const struct {
733 { AOME_SET_ENABLEAUTOALTREF,
OFFSET(auto_alt_ref) },
734 { AOME_SET_ARNR_MAXFRAMES,
OFFSET(arnr_max_frames) },
735 { AOME_SET_ARNR_STRENGTH,
OFFSET(arnr_strength) },
736 { AV1E_SET_ENABLE_CDEF,
OFFSET(enable_cdef) },
737 { AV1E_SET_ENABLE_RESTORATION,
OFFSET(enable_restoration) },
738 { AV1E_SET_ENABLE_RECT_PARTITIONS,
OFFSET(enable_rect_partitions) },
739 { AV1E_SET_ENABLE_1TO4_PARTITIONS,
OFFSET(enable_1to4_partitions) },
740 { AV1E_SET_ENABLE_AB_PARTITIONS,
OFFSET(enable_ab_partitions) },
741 { AV1E_SET_ENABLE_ANGLE_DELTA,
OFFSET(enable_angle_delta) },
742 { AV1E_SET_ENABLE_CFL_INTRA,
OFFSET(enable_cfl_intra) },
743 { AV1E_SET_ENABLE_FILTER_INTRA,
OFFSET(enable_filter_intra) },
744 { AV1E_SET_ENABLE_INTRA_EDGE_FILTER,
OFFSET(enable_intra_edge_filter) },
745 { AV1E_SET_ENABLE_PAETH_INTRA,
OFFSET(enable_paeth_intra) },
746 { AV1E_SET_ENABLE_SMOOTH_INTRA,
OFFSET(enable_smooth_intra) },
747 { AV1E_SET_ENABLE_PALETTE,
OFFSET(enable_palette) },
748 { AV1E_SET_ENABLE_TX64,
OFFSET(enable_tx64) },
749 { AV1E_SET_ENABLE_FLIP_IDTX,
OFFSET(enable_flip_idtx) },
750 { AV1E_SET_INTRA_DCT_ONLY,
OFFSET(use_intra_dct_only) },
751 { AV1E_SET_INTER_DCT_ONLY,
OFFSET(use_inter_dct_only) },
752 { AV1E_SET_INTRA_DEFAULT_TX_ONLY,
OFFSET(use_intra_default_tx_only) },
753 { AV1E_SET_REDUCED_TX_TYPE_SET,
OFFSET(reduced_tx_type_set) },
754 { AV1E_SET_ENABLE_REF_FRAME_MVS,
OFFSET(enable_ref_frame_mvs) },
755 { AV1E_SET_REDUCED_REFERENCE_SET,
OFFSET(enable_reduced_reference_set) },
756 { AV1E_SET_ENABLE_DIFF_WTD_COMP,
OFFSET(enable_diff_wtd_comp) },
757 { AV1E_SET_ENABLE_DIST_WTD_COMP,
OFFSET(enable_dist_wtd_comp) },
758 { AV1E_SET_ENABLE_DUAL_FILTER,
OFFSET(enable_dual_filter) },
759 { AV1E_SET_ENABLE_INTERINTER_WEDGE,
OFFSET(enable_interinter_wedge) },
760 { AV1E_SET_ENABLE_MASKED_COMP,
OFFSET(enable_masked_comp) },
761 { AV1E_SET_ENABLE_INTERINTRA_COMP,
OFFSET(enable_interintra_comp) },
762 { AV1E_SET_ENABLE_INTERINTRA_WEDGE,
OFFSET(enable_interintra_wedge) },
763 { AV1E_SET_ENABLE_OBMC,
OFFSET(enable_obmc) },
764 { AV1E_SET_ENABLE_ONESIDED_COMP,
OFFSET(enable_onesided_comp) },
765 { AV1E_SET_ENABLE_SMOOTH_INTERINTRA,
OFFSET(enable_smooth_interintra) },
766 };
767
769 const struct aom_codec_iface *iface)
770 {
773 struct aom_codec_enc_cfg enccfg = { 0 };
774 aom_codec_flags_t
flags =
776 int res;
777 aom_img_fmt_t img_fmt;
778 aom_codec_caps_t codec_caps = aom_codec_get_caps(iface);
779
782
783 if ((res = aom_codec_enc_config_default(iface, &enccfg,
ctx->usage)) != AOM_CODEC_OK) {
785 aom_codec_err_to_string(res));
787 }
788
791
796 }
797
799
800 enccfg.g_w = avctx->
width;
801 enccfg.g_h = avctx->
height;
804 enccfg.g_threads =
806
807 if (
ctx->lag_in_frames >= 0)
808 enccfg.g_lag_in_frames =
ctx->lag_in_frames;
809
811 enccfg.g_pass = AOM_RC_FIRST_PASS;
813 enccfg.g_pass = AOM_RC_LAST_PASS;
814 else
815 enccfg.g_pass = AOM_RC_ONE_PASS;
816
819 enccfg.rc_end_usage = AOM_CBR;
820 }
else if (
ctx->crf >= 0) {
821 enccfg.rc_end_usage = AOM_CQ;
823 enccfg.rc_end_usage = AOM_Q;
824 }
825
829 } else if (enccfg.rc_end_usage != AOM_Q) {
830 enccfg.rc_end_usage = AOM_Q;
833 "Neither bitrate nor constrained quality specified, using default CRF of %d\n",
835 }
836
837 if (avctx->
qmin >= 0)
838 enccfg.rc_min_quantizer = avctx->
qmin;
839 if (avctx->
qmax >= 0) {
840 enccfg.rc_max_quantizer = avctx->
qmax;
841 }
else if (!
ctx->crf) {
842 enccfg.rc_max_quantizer = 0;
843 }
844
845 if (enccfg.rc_end_usage == AOM_CQ || enccfg.rc_end_usage == AOM_Q) {
846 if (
ctx->crf < enccfg.rc_min_quantizer ||
ctx->crf > enccfg.rc_max_quantizer) {
848 "CQ level %d must be between minimum and maximum quantizer value (%d-%d)\n",
849 ctx->crf, enccfg.rc_min_quantizer, enccfg.rc_max_quantizer);
851 }
852 }
853
854 enccfg.rc_dropframe_thresh =
ctx->drop_threshold;
855
856 // 0-100 (0 => CBR, 100 => VBR)
858 if (
ctx->minsection_pct >= 0)
859 enccfg.rc_2pass_vbr_minsection_pct =
ctx->minsection_pct;
861 enccfg.rc_2pass_vbr_minsection_pct =
863 if (
ctx->maxsection_pct >= 0)
864 enccfg.rc_2pass_vbr_maxsection_pct =
ctx->maxsection_pct;
866 enccfg.rc_2pass_vbr_maxsection_pct =
868
870 enccfg.rc_buf_sz =
873 enccfg.rc_buf_initial_sz =
875 enccfg.rc_buf_optimal_sz = enccfg.rc_buf_sz * 5 / 6;
876
877 if (
ctx->rc_undershoot_pct >= 0)
878 enccfg.rc_undershoot_pct =
ctx->rc_undershoot_pct;
879 if (
ctx->rc_overshoot_pct >= 0)
880 enccfg.rc_overshoot_pct =
ctx->rc_overshoot_pct;
881
882 // _enc_init() will balk if kf_min_dist differs from max w/AOM_KF_AUTO
886 enccfg.kf_max_dist = avctx->
gop_size;
887
888 if (enccfg.g_pass == AOM_RC_FIRST_PASS)
889 enccfg.g_lag_in_frames = 0;
890 else if (enccfg.g_pass == AOM_RC_LAST_PASS) {
891 int decode_size,
ret;
892
896 }
897
898 ctx->twopass_stats.sz = strlen(avctx->
stats_in) * 3 / 4;
903 ctx->twopass_stats.sz);
904 ctx->twopass_stats.sz = 0;
906 }
908 ctx->twopass_stats.sz);
909 if (decode_size < 0) {
912 }
913
914 ctx->twopass_stats.sz = decode_size;
915 enccfg.rc_twopass_stats_in =
ctx->twopass_stats;
916 }
917
918 /* 0-3: For non-zero values the encoder increasingly optimizes for reduced
919 * complexity playback on low powered devices at the expense of encode
920 * quality. */
922 enccfg.g_profile = avctx->
profile;
923
924 enccfg.g_error_resilient =
ctx->error_resilient;
925
927 if (res < 0)
928 return res;
929
930 if (
ctx->still_picture) {
931 // Set the maximum number of frames to 1. This will let libaom set
932 // still_picture and reduced_still_picture_header to 1 in the Sequence
933 // Header as required by AVIF still images.
934 enccfg.g_limit = 1;
935 // Reduce memory usage for still images.
936 enccfg.g_lag_in_frames = 0;
937 // All frames will be key frames.
938 enccfg.kf_max_dist = 0;
939 enccfg.kf_mode = AOM_KF_DISABLED;
940 }
941
942 /* Construct Encoder Context */
943 res = aom_codec_enc_init(&
ctx->encoder, iface, &enccfg,
flags);
944 if (res != AOM_CODEC_OK) {
948 }
950
951 // codec control failures are currently treated only as warnings
954
959 }
965
970 } else {
974 }
975 if (
ctx->aq_mode >= 0)
977 if (
ctx->frame_parallel >= 0)
978 codecctl_int(avctx, AV1E_SET_FRAME_PARALLEL_DECODING,
ctx->frame_parallel);
980
982 if (
ctx->uniform_tiles) {
985 }
986
987 if (
ctx->denoise_noise_level >= 0)
988 codecctl_int(avctx, AV1E_SET_DENOISE_NOISE_LEVEL,
ctx->denoise_noise_level);
989 if (
ctx->denoise_block_size >= 0)
990 codecctl_int(avctx, AV1E_SET_DENOISE_BLOCK_SIZE,
ctx->denoise_block_size);
991 if (
ctx->enable_global_motion >= 0)
992 codecctl_int(avctx, AV1E_SET_ENABLE_GLOBAL_MOTION,
ctx->enable_global_motion);
993 if (avctx->
refs >= 3) {
995 }
996 if (
ctx->row_mt >= 0)
998 if (
ctx->enable_intrabc >= 0)
1000
1001 #if AOM_ENCODER_ABI_VERSION >= 23
1002 {
1004
1006 int ret = aom_codec_set_option(&
ctx->encoder, en->
key, en->
value);
1007 if (
ret != AOM_CODEC_OK) {
1010 }
1011 }
1012 }
1013 #endif
1014
1015 // provide dummy value to initialize wrapper, values will be updated each _encode()
1016 aom_img_wrap(&
ctx->rawimg, img_fmt, avctx->
width, avctx->
height, 1,
1017 (unsigned char*)1);
1018
1019 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH)
1020 ctx->rawimg.bit_depth = enccfg.g_bit_depth;
1021
1022 ctx->dovi.logctx = avctx;
1024 return res;
1025
1029
1032 "not found. This is a bug, please report it.\n");
1034 }
1038
1042
1046 }
1047
1049 if (!cpb_props)
1051
1052 if (enccfg.rc_end_usage == AOM_CBR ||
1053 enccfg.g_pass != AOM_RC_ONE_PASS) {
1057 }
1059
1060 return 0;
1061 }
1062
1065 const struct aom_codec_cx_pkt *
src)
1066 {
1067 dst->pts =
src->data.frame.pts;
1068 dst->duration =
src->data.frame.duration;
1069 dst->flags =
src->data.frame.flags;
1070 dst->sz =
src->data.frame.sz;
1071 dst->buf =
src->data.frame.buf;
1072 dst->frame_number = ++
ctx->frame_number;
1073 dst->have_sse =
ctx->have_sse;
1074 if (
ctx->have_sse) {
1075 /* associate last-seen SSE to the frame. */
1076 /* Transfers ownership from ctx to dst. */
1077 memcpy(
dst->sse,
ctx->sse,
sizeof(
dst->sse));
1079 }
1080 }
1081
1082 /**
1083 * Store coded frame information in format suitable for return from encode2().
1084 *
1085 * Write information from @a cx_frame to @a pkt
1086 * @return packet data size on success
1087 * @return a negative AVERROR on error
1088 */
1091 {
1097 "Error getting output packet of size %"SIZE_SPECIFIER ".\n", cx_frame->
sz);
1099 }
1103
1104 if (!!(cx_frame->
flags & AOM_FRAME_IS_KEY)) {
1107 }
else if (cx_frame->
flags & AOM_FRAME_IS_INTRAONLY) {
1109 } else {
1111 }
1112
1114 cx_frame->
have_sse ? 3 : 0, pict_type);
1115
1118 for (
i = 0;
i < 3; ++
i) {
1120 }
1122 }
1123
1128 "failed to send input packet\n");
1130 }
1132
1135 "failed to receive output packet\n");
1137 }
1138 }
1140 }
1141
1142 /**
1143 * Queue multiple output frames from the encoder, returning the front-most.
1144 * In cases where aom_codec_get_cx_data() returns more than 1 frame append
1145 * the frame queue. Return the head frame if available.
1146 * @return Stored frame size
1147 * @return AVERROR(EINVAL) on output size error
1148 * @return AVERROR(ENOMEM) on coded frame queue data allocation error
1149 */
1151 {
1153 const struct aom_codec_cx_pkt *
pkt;
1154 const void *iter =
NULL;
1156
1157 if (
ctx->coded_frame_list) {
1159 /* return the leading frame if we've already begun queueing */
1163 ctx->coded_frame_list = cx_frame->
next;
1165 }
1166
1167 /* consume all available output from the encoder before returning. buffers
1168 * are only good through the next aom_codec call */
1169 while ((
pkt = aom_codec_get_cx_data(&
ctx->encoder, &iter))) {
1170 switch (
pkt->kind) {
1171 case AOM_CODEC_CX_FRAME_PKT:
1174
1175 /* avoid storing the frame when the list is empty and we haven't yet
1176 * provided a frame for output */
1182 } else {
1185
1186 if (!cx_frame) {
1188 "Frame queue element alloc failed\n");
1190 }
1193
1194 if (!cx_frame->
buf) {
1200 }
1203 }
1204 break;
1205 case AOM_CODEC_STATS_PKT:
1206 {
1207 struct aom_fixed_buf *
stats = &
ctx->twopass_stats;
1209 &
ctx->twopass_stats_size,
1217 }
1222 break;
1223 }
1224 case AOM_CODEC_PSNR_PKT:
1225 {
1232 break;
1233 }
1234 case AOM_CODEC_CUSTOM_PKT:
1235 // ignore unsupported/unrecognized packet types
1236 break;
1237 }
1238 }
1239
1241 }
1242
1244 {
1246 case AOM_IMG_FMT_I420:
1247 case AOM_IMG_FMT_I42016:
1248 if (
img->bit_depth == 8)
1250 else if (
img->bit_depth == 10)
1252 else
1254 case AOM_IMG_FMT_I422:
1255 case AOM_IMG_FMT_I42216:
1256 if (
img->bit_depth == 8)
1258 else if (
img->bit_depth == 10)
1260 else
1262 case AOM_IMG_FMT_I444:
1263 case AOM_IMG_FMT_I44416:
1264 if (
img->bit_depth == 8)
1266 else if (
img->bit_depth == 10)
1268 else
1270 };
1272 }
1273
1276 {
1278 struct aom_image *rawimg =
NULL;
1281 int res, coded_size;
1282 aom_enc_frame_flags_t
flags = 0;
1284
1286 rawimg = &
ctx->rawimg;
1287 aom_img_remove_metadata(rawimg);
1288 rawimg->planes[AOM_PLANE_Y] =
frame->data[0];
1289 rawimg->planes[AOM_PLANE_U] =
frame->data[1];
1290 rawimg->planes[AOM_PLANE_V] =
frame->data[2];
1291 rawimg->stride[AOM_PLANE_Y] =
frame->linesize[0];
1292 rawimg->stride[AOM_PLANE_U] =
frame->linesize[1];
1293 rawimg->stride[AOM_PLANE_V] =
frame->linesize[2];
1294 timestamp =
frame->pts;
1295
1296 if (
frame->duration > ULONG_MAX) {
1298 "Frame duration too large: %"PRId64
"\n",
frame->duration);
1299 }
else if (
frame->duration)
1303 else {
1305 }
1306
1307 switch (
frame->color_range) {
1309 rawimg->range = AOM_CR_STUDIO_RANGE;
1310 break;
1312 rawimg->range = AOM_CR_FULL_RANGE;
1313 break;
1314 }
1315
1316 aom_img_remove_metadata(rawimg);
1318 if (
ctx->dovi.cfg.dv_profile && sd) {
1320 uint8_t *t35;
1324 return res;
1325 res = aom_img_add_metadata(rawimg, OBU_METADATA_TYPE_ITUT_T35,
1326 t35,
size, AOM_MIF_ANY_FRAME);
1328 if (res != AOM_CODEC_OK)
1330 }
else if (
ctx->dovi.cfg.dv_profile) {
1332 "without AV_FRAME_DATA_DOVI_METADATA\n");
1334 }
1335
1337 flags |= AOM_EFLAG_FORCE_KF;
1338
1340 if (res < 0)
1341 return res;
1342 }
1343
1345 if (res != AOM_CODEC_OK) {
1348 }
1350 if (coded_size < 0)
1351 return coded_size;
1352
1355
1359 b64_size);
1361 }
1363 ctx->twopass_stats.sz);
1364 }
1365
1366 *got_packet = !!coded_size;
1367
1370 struct aom_image
img;
1371
1373
1375 if (res < 0)
1376 return res;
1377
1381 "Unhandled reconstructed frame colorspace: %d\n",
1384 }
1385
1388
1390 if (res < 0)
1391 return res;
1392
1393 if ((
img.fmt & AOM_IMG_FMT_HIGHBITDEPTH) &&
img.bit_depth == 8)
1395 else {
1396 const uint8_t *
planes[4] = {
img.planes[0],
img.planes[1],
img.planes[2] };
1397 const int stride[4] = {
img.stride[0],
img.stride[1],
img.stride[2] };
1398
1401 }
1402 }
1403
1404 return 0;
1405 }
1406
1413 };
1414
1422 };
1423
1438 };
1439
1457 };
1458
1463 int *out_num)
1464 {
1466 int supports_monochrome = aom_codec_version() >= 20001;
1467 aom_codec_caps_t codec_caps = aom_codec_get_caps(aom_codec_av1_cx());
1468 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {
1469 if (supports_monochrome) {
1472 } else {
1475 }
1476 } else {
1477 if (supports_monochrome) {
1480 } else {
1483 }
1484 }
1485 return 0;
1486 }
1487
1489 }
1490
1492 {
1493 return aom_init(avctx, aom_codec_av1_cx());
1494 }
1495
1496 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
1499 { "auto-alt-ref", "Enable use of alternate reference "
1501 { "lag-in-frames", "Number of frames to look ahead at for "
1503 {
"arnr-max-frames",
"altref noise reduction max frame count",
OFFSET(arnr_max_frames),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
VE},
1504 {
"arnr-strength",
"altref noise reduction filter strength",
OFFSET(arnr_strength),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6,
VE},
1505 {
"aq-mode",
"adaptive quantization mode",
OFFSET(aq_mode),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 4,
VE, .unit =
"aq_mode"},
1507 {
"variance",
"Variance based Aq", 0,
AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0,
VE, .unit =
"aq_mode"},
1508 {
"complexity",
"Complexity based Aq", 0,
AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0,
VE, .unit =
"aq_mode"},
1509 {
"cyclic",
"Cyclic Refresh Aq", 0,
AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0,
VE, .unit =
"aq_mode"},
1510 {
"error-resilience",
"Error resilience configuration",
OFFSET(error_resilient),
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX,
VE, .unit =
"er"},
1511 {
"default",
"Improve resiliency against losses of whole frames", 0,
AV_OPT_TYPE_CONST, {.i64 = AOM_ERROR_RESILIENT_DEFAULT}, 0, 0,
VE, .unit =
"er"},
1512 {
"crf",
"Select the quality for constant quality mode", offsetof(AOMContext, crf),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63,
VE },
1513 {
"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 },
1514 {
"drop-threshold",
"Frame drop threshold", offsetof(AOMContext, drop_threshold),
AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX,
VE },
1515 {
"denoise-noise-level",
"Amount of noise to be removed",
OFFSET(denoise_noise_level),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
VE},
1516 {
"denoise-block-size",
"Denoise block size ",
OFFSET(denoise_block_size),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
VE},
1517 {
"undershoot-pct",
"Datarate undershoot (min) target (%)",
OFFSET(rc_undershoot_pct),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 100,
VE},
1518 {
"overshoot-pct",
"Datarate overshoot (max) target (%)",
OFFSET(rc_overshoot_pct),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1000,
VE},
1519 {
"minsection-pct",
"GOP min bitrate (% of target)",
OFFSET(minsection_pct),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 100,
VE},
1520 {
"maxsection-pct",
"GOP max bitrate (% of target)",
OFFSET(maxsection_pct),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 5000,
VE},
1521 {
"frame-parallel",
"Enable frame parallel decodability features",
OFFSET(frame_parallel),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1523 {
"tile-columns",
"Log2 of number of tile columns to use",
OFFSET(tile_cols_log2),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6,
VE},
1524 {
"tile-rows",
"Log2 of number of tile rows to use",
OFFSET(tile_rows_log2),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6,
VE},
1527 {
"enable-global-motion",
"Enable global motion",
OFFSET(enable_global_motion),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1528 {
"enable-intrabc",
"Enable intra block copy prediction mode",
OFFSET(enable_intrabc),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1529 {
"enable-restoration",
"Enable Loop Restoration filtering",
OFFSET(enable_restoration),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1530 {
"usage",
"Quality and compression efficiency vs speed trade-off",
OFFSET(
usage),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX,
VE, .unit =
"usage"},
1531 {
"good",
"Good quality", 0,
AV_OPT_TYPE_CONST, {.i64 = 0
/* AOM_USAGE_GOOD_QUALITY */}, 0, 0,
VE, .unit =
"usage"},
1532 {
"realtime",
"Realtime encoding", 0,
AV_OPT_TYPE_CONST, {.i64 = 1
/* AOM_USAGE_REALTIME */}, 0, 0,
VE, .unit =
"usage"},
1533 {
"allintra",
"All Intra encoding", 0,
AV_OPT_TYPE_CONST, {.i64 = 2
/* AOM_USAGE_ALL_INTRA */}, 0, 0,
VE, .unit =
"usage"},
1534 {
"tune",
"The metric that the encoder tunes for. Automatically chosen by the encoder by default",
OFFSET(tune),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, AOM_TUNE_SSIM,
VE, .unit =
"tune"},
1538 {
"still-picture",
"Encode in single frame mode (typically used for still AVIF images).",
OFFSET(still_picture),
AV_OPT_TYPE_BOOL, {.i64 = 0}, -1, 1,
VE },
1541 {
"enable-rect-partitions",
"Enable rectangular partitions",
OFFSET(enable_rect_partitions),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1542 {
"enable-1to4-partitions",
"Enable 1:4/4:1 partitions",
OFFSET(enable_1to4_partitions),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1543 {
"enable-ab-partitions",
"Enable ab shape partitions",
OFFSET(enable_ab_partitions),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1544 {
"enable-angle-delta",
"Enable angle delta intra prediction",
OFFSET(enable_angle_delta),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1545 {
"enable-cfl-intra",
"Enable chroma predicted from luma intra prediction",
OFFSET(enable_cfl_intra),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1546 {
"enable-filter-intra",
"Enable filter intra predictor",
OFFSET(enable_filter_intra),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1547 {
"enable-intra-edge-filter",
"Enable intra edge filter",
OFFSET(enable_intra_edge_filter),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1548 {
"enable-smooth-intra",
"Enable smooth intra prediction mode",
OFFSET(enable_smooth_intra),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1549 {
"enable-paeth-intra",
"Enable paeth predictor in intra prediction",
OFFSET(enable_paeth_intra),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1550 {
"enable-palette",
"Enable palette prediction mode",
OFFSET(enable_palette),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1551 {
"enable-flip-idtx",
"Enable extended transform type",
OFFSET(enable_flip_idtx),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1553 {
"reduced-tx-type-set",
"Use reduced set of transform types",
OFFSET(reduced_tx_type_set),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1554 {
"use-intra-dct-only",
"Use DCT only for INTRA modes",
OFFSET(use_intra_dct_only),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1555 {
"use-inter-dct-only",
"Use DCT only for INTER modes",
OFFSET(use_inter_dct_only),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1556 {
"use-intra-default-tx-only",
"Use default-transform only for INTRA modes",
OFFSET(use_intra_default_tx_only),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1557 {
"enable-ref-frame-mvs",
"Enable temporal mv prediction",
OFFSET(enable_ref_frame_mvs),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1558 {
"enable-reduced-reference-set",
"Use reduced set of single and compound references",
OFFSET(enable_reduced_reference_set),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1560 {
"enable-dual-filter",
"Enable dual filter",
OFFSET(enable_dual_filter),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1561 {
"enable-diff-wtd-comp",
"Enable difference-weighted compound",
OFFSET(enable_diff_wtd_comp),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1562 {
"enable-dist-wtd-comp",
"Enable distance-weighted compound",
OFFSET(enable_dist_wtd_comp),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1563 {
"enable-onesided-comp",
"Enable one sided compound",
OFFSET(enable_onesided_comp),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1564 {
"enable-interinter-wedge",
"Enable interinter wedge compound",
OFFSET(enable_interinter_wedge),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1565 {
"enable-interintra-wedge",
"Enable interintra wedge compound",
OFFSET(enable_interintra_wedge),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1566 {
"enable-masked-comp",
"Enable masked compound",
OFFSET(enable_masked_comp),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1567 {
"enable-interintra-comp",
"Enable interintra compound",
OFFSET(enable_interintra_comp),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1568 {
"enable-smooth-interintra",
"Enable smooth interintra mode",
OFFSET(enable_smooth_interintra),
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1,
VE},
1569 #if AOM_ENCODER_ABI_VERSION >= 23
1570 {
"aom-params",
"Set libaom options using a :-separated list of key=value pairs",
OFFSET(aom_params),
AV_OPT_TYPE_DICT, { 0 }, 0, 0,
VE },
1571 #endif
1573 };
1574
1576 { "b", "0" },
1577 { "qmin", "-1" },
1578 { "qmax", "-1" },
1579 { "g", "-1" },
1580 { "keyint_min", "-1" },
1582 };
1583
1589 };
1590
1592 .
p.
name =
"libaom-av1",
1602 .p.wrapper_name = "libaom",
1603 .priv_data_size = sizeof(AOMContext),
1612 };