| 467 | static const avifScalingMode noScaling = { { 1, 1 }, { 1, 1 } }; |
| 468 | |
| 469 | avifEncoder * avifEncoderCreate(void) |
| 470 | { |
| 471 | avifEncoder * encoder = (avifEncoder *)avifAlloc(sizeof(avifEncoder)); |
| 472 | if (!encoder) { |
| 473 | return NULL; |
| 474 | } |
| 475 | memset(encoder, 0, sizeof(avifEncoder)); |
| 476 | encoder->codecChoice = AVIF_CODEC_CHOICE_AUTO; |
| 477 | encoder->maxThreads = 1; |
| 478 | encoder->speed = AVIF_SPEED_DEFAULT; |
| 479 | encoder->keyframeInterval = 0; |
| 480 | encoder->timescale = 1; |
| 481 | encoder->repetitionCount = AVIF_REPETITION_COUNT_INFINITE; |
| 482 | encoder->quality = AVIF_QUALITY_DEFAULT; |
| 483 | encoder->qualityAlpha = AVIF_QUALITY_DEFAULT; |
| 484 | encoder->qualityGainMap = AVIF_QUALITY_DEFAULT; |
| 485 | encoder->minQuantizer = AVIF_QUANTIZER_BEST_QUALITY; |
| 486 | encoder->maxQuantizer = AVIF_QUANTIZER_WORST_QUALITY; |
| 487 | encoder->minQuantizerAlpha = AVIF_QUANTIZER_BEST_QUALITY; |
| 488 | encoder->maxQuantizerAlpha = AVIF_QUANTIZER_WORST_QUALITY; |
| 489 | encoder->tileRowsLog2 = 0; |
| 490 | encoder->tileColsLog2 = 0; |
| 491 | encoder->autoTiling = AVIF_FALSE; |
| 492 | encoder->scalingMode = noScaling; |
| 493 | encoder->data = avifEncoderDataCreate(); |
| 494 | encoder->csOptions = avifCodecSpecificOptionsCreate(); |
| 495 | if (!encoder->data || !encoder->csOptions) { |
| 496 | avifEncoderDestroy(encoder); |
| 497 | return NULL; |
| 498 | } |
| 499 | encoder->headerFormat = AVIF_HEADER_DEFAULT; |
| 500 | encoder->creationTime = 0; |
| 501 | encoder->modificationTime = 0; |
| 502 | encoder->sampleTransformRecipe = AVIF_SAMPLE_TRANSFORM_NONE; |
| 503 | return encoder; |
| 504 | } |
| 505 | |
| 506 | void avifEncoderDestroy(avifEncoder * encoder) |
| 507 | { |