From cca5f22a9a00d41cc44cb571f480c9cc4d5c8cb5 Mon Sep 17 00:00:00 2001 From: Lakshmi Kumar Date: Tue, 12 Mar 2024 10:27:34 -0700 Subject: [PATCH] Bug Fix - Batch sample (#283) * bug fix for new dec creation * move bit depth change after creating new dec * codec update for every new dec --- samples/videoDecodeBatch/videodecodebatch.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/samples/videoDecodeBatch/videodecodebatch.cpp b/samples/videoDecodeBatch/videodecodebatch.cpp index 22f14bb0ac..9857f5c370 100644 --- a/samples/videoDecodeBatch/videodecodebatch.cpp +++ b/samples/videoDecodeBatch/videodecodebatch.cpp @@ -353,11 +353,10 @@ int main(int argc, char **argv) { rocDecVideoCodec codec_id = AVCodec2RocDecVideoCodec(v_demuxer[j]->GetCodecID()); if (v_dec_info[thread_idx]->bit_depth != bit_depth || v_dec_info[thread_idx]->rocdec_codec_id != codec_id) { if (bit_depth == 8) { // can be HEVC or H.264 - v_dec_info[thread_idx]->bit_depth = 8; - if (dec_8bit_avc == nullptr) { + if (dec_8bit_avc == nullptr && codec_id == rocDecVideoCodec_AVC) { std::unique_ptr dec_8bit_avc(new RocVideoDecoder(v_dec_info[thread_idx]->dec_device_id, mem_type, codec_id, b_force_zero_latency, p_crop_rect)); v_dec_info[thread_idx]->viddec = std::move(dec_8bit_avc); - } else if (dec_8bit_hevc == nullptr) { + } else if (dec_8bit_hevc == nullptr && codec_id == rocDecVideoCodec_HEVC) { std::unique_ptr dec_8bit_hevc(new RocVideoDecoder(v_dec_info[thread_idx]->dec_device_id, mem_type, codec_id, b_force_zero_latency, p_crop_rect)); v_dec_info[thread_idx]->viddec = std::move(dec_8bit_hevc); } else { @@ -367,14 +366,17 @@ int main(int argc, char **argv) { v_dec_info[thread_idx]->viddec.swap(dec_8bit_hevc); } } + v_dec_info[thread_idx]->bit_depth = bit_depth; + v_dec_info[thread_idx]->rocdec_codec_id = codec_id; } else { // bit_depth = 10bit; only HEVC - v_dec_info[thread_idx]->bit_depth = 10; if (dec_10bit_hevc == nullptr) { std::unique_ptr dec_10bit_hevc(new RocVideoDecoder(v_dec_info[thread_idx]->dec_device_id, mem_type, codec_id, b_force_zero_latency, p_crop_rect)); v_dec_info[thread_idx]->viddec = std::move(dec_10bit_hevc); } else { v_dec_info[thread_idx]->viddec.swap(dec_10bit_hevc); } + v_dec_info[thread_idx]->bit_depth = bit_depth; + v_dec_info[thread_idx]->rocdec_codec_id = codec_id; } } v_dec_info[thread_idx]->viddec->GetDeviceinfo(device_name, gcn_arch_name, pci_bus_id, pci_domain_id, pci_device_id);