Skip to content

Commit

Permalink
Animated AVIF fix
Browse files Browse the repository at this point in the history
Quick fix image failure when looping back in an animated AVIF. For libavif's samples of alpha_video.avif and Chimera-AV1-10bit-480x270.avif.
  • Loading branch information
sdneon committed Apr 29, 2024
1 parent a9968bb commit 864baff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/JPEGView/ImageLoadThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,13 @@ void CImageLoadThread::ProcessReadAVIFRequest(CRequest* request) {
// * number of total images in the AVIF (decoder->imageCount)
// * overall image sequence timing (including per-frame timing with avifDecoderNthImageTiming())

if (avifDecoderNextImage(m_avifDecoder) == AVIF_RESULT_OK)
avifResult r = avifDecoderNextImage(m_avifDecoder);
if (r != AVIF_RESULT_OK)
{
//probably looping back on animation, so just retry using 'avifDecoderNthImage'
r = avifDecoderNthImage(m_avifDecoder, m_avifDecoder->imageIndex);
}
if (r == AVIF_RESULT_OK)
{
// Now available (for this frame):
// * All decoder->image YUV pixel data (yuvFormat, yuvPlanes, yuvRange, yuvChromaSamplePosition, yuvRowBytes)
Expand Down
12 changes: 6 additions & 6 deletions src/JPEGView/JPEGView.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@
<ClCompile Include="ICCProfileTransform.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PSDWrapper.cpp">
<Filter>Source Files\Image Types</Filter>
</ClCompile>
<ClCompile Include="QOIWrapper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PSDWrapper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RAWWrapper.cpp">
<Filter>Source Files\Image Types</Filter>
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -540,10 +540,10 @@
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PSDWrapper.h">
<Filter>Header Files\Image Types</Filter>
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RAWWrapper.h">
<Filter>Header Files\Image Types</Filter>
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit 864baff

Please sign in to comment.