const uint8_t *const pkt_buf = pkt->data.twopass_stats.buf;
const size_t pkt_size = pkt->data.twopass_stats.sz;
stats->buf = realloc(stats->buf, stats->sz + pkt_size);
+ if (!stats->buf) die("Failed to reallocate stats buffer.");
memcpy((uint8_t *)stats->buf + stats->sz, pkt_buf, pkt_size);
stats->sz += pkt_size;
}
firstpass_stats_.buf =
realloc(firstpass_stats_.buf, firstpass_stats_.sz + pkt_size);
+ ASSERT_NE(firstpass_stats_.buf, nullptr);
memcpy((uint8_t *)firstpass_stats_.buf + firstpass_stats_.sz, pkt_buf,
pkt_size);
firstpass_stats_.sz += pkt_size;
psnry = realloc(psnry, allocated_frames * sizeof(*psnry));
psnru = realloc(psnru, allocated_frames * sizeof(*psnru));
psnrv = realloc(psnrv, allocated_frames * sizeof(*psnrv));
+ if (!(ssimy && ssimu && ssimv && psnry && psnru && psnrv)) {
+ fprintf(stderr, "Error allocating SSIM/PSNR data.\n");
+ exit(EXIT_FAILURE);
+ }
}
psnr_and_ssim(ssimy[n_frames], psnry[n_frames], y[0], y[1], w, h);
psnr_and_ssim(ssimu[n_frames], psnru[n_frames], u[0], u[1], (w + 1) / 2,