@@ -96,9 +96,6 @@ static avifBool gav1CodecGetNextImage(struct avifCodec * codec,
9696 break ;
9797 }
9898
99- // Throw away the old color planes if there are
100- avifImageFreePlanes (image , AVIF_PLANES_YUV );
101-
10299 image -> width = gav1Image -> displayed_width [0 ];
103100 image -> height = gav1Image -> displayed_height [0 ];
104101 image -> depth = gav1Image -> bitdepth ;
@@ -112,6 +109,7 @@ static avifBool gav1CodecGetNextImage(struct avifCodec * codec,
112109 image -> matrixCoefficients = (avifMatrixCoefficients )gav1Image -> matrix_coefficients ;
113110
114111 // Steal the pointers from the decoder's image directly
112+ avifImageFreePlanes (image , AVIF_PLANES_YUV );
115113 int yuvPlaneCount = (yuvFormat == AVIF_PIXEL_FORMAT_YUV400 ) ? 1 : 3 ;
116114 for (int yuvPlane = 0 ; yuvPlane < yuvPlaneCount ; ++ yuvPlane ) {
117115 image -> yuvPlanes [yuvPlane ] = gav1Image -> plane [yuvPlane ];
@@ -121,9 +119,6 @@ static avifBool gav1CodecGetNextImage(struct avifCodec * codec,
121119 } else {
122120 // Alpha plane - set image to correct size, fill alpha
123121
124- // Throw away the old alpha plane if there are
125- avifImageFreePlanes (image , AVIF_PLANES_A );
126-
127122 image -> width = gav1Image -> displayed_width [0 ];
128123 image -> height = gav1Image -> displayed_height [0 ];
129124 image -> depth = gav1Image -> bitdepth ;
0 commit comments