+ if (avctx->err_recognition & AV_EF_CRCCHECK &&
+ s->fileversion >= 3900 && s->bps < 24) {
+ uint32_t crc = s->CRC_state;
+ const AVCRC *crc_tab = av_crc_get_table(AV_CRC_32_IEEE_LE);
+ for (i = 0; i < blockstodecode; i++) {
+ for (ch = 0; ch < s->channels; ch++) {
+ uint8_t *smp = frame->data[ch] + (i*(s->bps >> 3));
+ crc = av_crc(crc_tab, crc, smp, s->bps >> 3);
+ }
+ }
+
+ if (!s->samples && (~crc >> 1) ^ s->CRC) {
+ av_log(avctx, AV_LOG_ERROR, "CRC mismatch! Previously decoded "
+ "frames may have been affected as well.\n");
+ if (avctx->err_recognition & AV_EF_EXPLODE)
+ return AVERROR_INVALIDDATA;
+ }
+
+ s->CRC_state = crc;
+ }
+