| 1087 | } |
| 1088 | |
| 1089 | static avifResult avifEncoderWriteSampleTransformPayload(avifEncoder * encoder, avifRWData * data) |
| 1090 | { |
| 1091 | avifRWStream s; |
| 1092 | avifRWStreamStart(&s, data); |
| 1093 | AVIF_CHECKRES(avifRWStreamWriteBits(&s, 0, /*bitCount=*/2)); // unsigned int(2) version = 0; |
| 1094 | AVIF_CHECKRES(avifRWStreamWriteBits(&s, 0, /*bitCount=*/4)); // unsigned int(4) reserved; |
| 1095 | // AVIF_SAMPLE_TRANSFORM_BIT_DEPTH_32 is necessary because the two input images |
| 1096 | // once combined use 16-bit unsigned values, but intermediate results are stored in signed integers. |
| 1097 | AVIF_CHECKRES(avifRWStreamWriteBits(&s, AVIF_SAMPLE_TRANSFORM_BIT_DEPTH_32, /*bitCount=*/2)); // unsigned int(2) bit_depth; |
| 1098 | |
| 1099 | avifSampleTransformExpression expression = { 0 }; |
| 1100 | AVIF_CHECKRES(avifSampleTransformRecipeToExpression(encoder->sampleTransformRecipe, &expression)); |
| 1101 | const avifResult result = avifEncoderWriteSampleTransformTokens(&s, &expression); |
| 1102 | avifArrayDestroy(&expression); |
| 1103 | if (result != AVIF_RESULT_OK) { |
| 1104 | avifDiagnosticsPrintf(&encoder->diag, "Failed to write sample transform metadata for recipe %d", (int)encoder->sampleTransformRecipe); |
| 1105 | return result; |
| 1106 | } |
| 1107 | |
| 1108 | avifRWStreamFinishWrite(&s); |
| 1109 | return AVIF_RESULT_OK; |
| 1110 | } |
| 1111 | |
| 1112 | static avifResult avifEncoderDataCreateExifItem(avifEncoderData * data, const avifRWData * exif) |
| 1113 | { |
no test coverage detected