@@ -147,18 +147,6 @@ AvifDecoder::~AvifDecoder() {
147147
148148size_t AvifDecoder::signatureLength () const { return kAvifSignatureSize ; }
149149
150- bool AvifDecoder::checkSignature (const String &signature) const {
151- avifDecoder *decoder = avifDecoderCreate ();
152- if (!decoder) return false ;
153- avifDecoderSetIOMemory (decoder,
154- reinterpret_cast <const uint8_t *>(signature.c_str ()),
155- signature.size ());
156- decoder->io ->sizeHint = 1e9 ;
157- const avifResult status = avifDecoderParse (decoder);
158- avifDecoderDestroy (decoder);
159- return (status == AVIF_RESULT_OK || status == AVIF_RESULT_TRUNCATED_DATA);
160- }
161-
162150#define OPENCV_AVIF_CHECK_STATUS (X, ENCDEC ) \
163151 { \
164152 const avifResult status = (X); \
@@ -170,6 +158,20 @@ bool AvifDecoder::checkSignature(const String &signature) const {
170158 } \
171159 }
172160
161+ bool AvifDecoder::checkSignature (const String &signature) const {
162+ avifDecoder *decoder = avifDecoderCreate ();
163+ if (!decoder) return false ;
164+ OPENCV_AVIF_CHECK_STATUS (
165+ avifDecoderSetIOMemory (
166+ decoder, reinterpret_cast <const uint8_t *>(signature.c_str ()),
167+ signature.size ()),
168+ decoder);
169+ decoder->io ->sizeHint = 1e9 ;
170+ const avifResult status = avifDecoderParse (decoder);
171+ avifDecoderDestroy (decoder);
172+ return (status == AVIF_RESULT_OK || status == AVIF_RESULT_TRUNCATED_DATA);
173+ }
174+
173175ImageDecoder AvifDecoder::newDecoder () const { return makePtr<AvifDecoder>(); }
174176
175177bool AvifDecoder::readHeader () {
0 commit comments