MCPcopy Create free account
hub / github.com/AOMediaCodec/libavif / avifEncodeRestOfImageSequence

Function avifEncodeRestOfImageSequence

apps/avifenc.c:904–986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

902}
903
904static avifBool avifEncodeRestOfImageSequence(avifEncoder * encoder,
905 const avifSettings * settings,
906 avifInput * input,
907 int imageIndex,
908 const avifImage * firstImage)
909{
910 avifBool success = AVIF_FALSE;
911 avifImage * nextImage = NULL;
912 const avifInputFileSettings * nextSettings = NULL;
913
914 const avifInputFile * nextFile;
915 while ((nextFile = avifInputGetFile(input, imageIndex)) != NULL) {
916 uint64_t nextDurationInTimescales = nextFile->duration ? nextFile->duration : settings->outputTiming.duration;
917
918 if (nextImage) {
919 avifImageDestroy(nextImage);
920 }
921 nextImage = avifImageCreateEmpty();
922 if (!nextImage) {
923 fprintf(stderr, "ERROR: Out of memory\n");
924 goto cleanup;
925 }
926 nextImage->colorPrimaries = firstImage->colorPrimaries;
927 nextImage->transferCharacteristics = firstImage->transferCharacteristics;
928 nextImage->matrixCoefficients = firstImage->matrixCoefficients;
929 nextImage->yuvRange = firstImage->yuvRange;
930 nextImage->alphaPremultiplied = firstImage->alphaPremultiplied;
931
932 // Ignore ICC, Exif and XMP because only the metadata of the first frame is taken into
933 // account by the libavif API.
934 // Ignore gain map as it's not supported for sequences.
935 if (!avifInputReadImage(input,
936 imageIndex,
937 /*ignoreColorProfile=*/AVIF_TRUE,
938 /*ignoreExif=*/AVIF_TRUE,
939 /*ignoreXMP=*/AVIF_TRUE,
940 /*allowChangingCicp=*/AVIF_FALSE,
941 /*ignoreGainMap=*/AVIF_TRUE,
942 nextImage,
943 &nextSettings,
944 /*outDepth=*/NULL,
945 /*sourceIsRGB=*/NULL,
946 /*sourceTiming=*/NULL,
947 settings->chromaDownsampling,
948 settings->inputFormat)) {
949 goto cleanup;
950 }
951 if (!avifEncoderVerifyImageCompatibility(firstImage, nextImage, "sequence", avifPrettyFilename(nextFile->filename))) {
952 goto cleanup;
953 }
954 if (!avifEncodeUpdateEncoderSettings(encoder, nextSettings)) {
955 goto cleanup;
956 }
957
958 char manualTilingStr[128];
959 snprintf(manualTilingStr, sizeof(manualTilingStr), "tileRowsLog2 [%d], tileColsLog2 [%d]", encoder->tileRowsLog2, encoder->tileColsLog2);
960
961 printf(" * Encoding frame %d [%" PRIu64 "/%" PRIu64 " ts] color quality [%d (%s)], alpha quality [%d (%s)], %s: %s\n",

Callers 1

Calls 10

avifInputGetFileFunction · 0.85
avifImageDestroyFunction · 0.85
avifImageCreateEmptyFunction · 0.85
avifInputReadImageFunction · 0.85
avifPrettyFilenameFunction · 0.85
qualityStringFunction · 0.85
avifEncoderAddImageFunction · 0.85
avifResultToStringFunction · 0.85

Tested by

no test coverage detected