From 8f6467ba497b5ea3119d6f9e730ab11af1fb6c43 Mon Sep 17 00:00:00 2001 From: Jean Christophe DE RYCK Date: Mon, 6 Jan 2020 19:20:11 +0200 Subject: [PATCH 1/2] Correct CPI table for UHD I_end values in ClipInf CPI Table are determined by thresholds on I-frame sizes. These threshold sizes are different for TS_Recording_Rate <= 60000000 (HD), and for TS_Recording_Rate > 60000000 (4K). This patch solves issue #107 The commit must be merged after commit #111 for V3_flags / Dolby Vision Integration. --- tsMuxer/tsPacket.cpp | 49 +++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/tsMuxer/tsPacket.cpp b/tsMuxer/tsPacket.cpp index 253b2df2..e1584551 100644 --- a/tsMuxer/tsPacket.cpp +++ b/tsMuxer/tsPacket.cpp @@ -962,23 +962,38 @@ void CLPIParser::composeEP_map_for_one_stream_PID(BitStreamWriter& writer, M2TSS writer.putBit(0); //is_angle_change_point[EP_fine_id] 1 bslbf int endCode = 0; if (indexData.m_frameLen > 0) { - if (indexData.m_frameLen < 131072) - endCode = 1; - else if (indexData.m_frameLen < 131072) - endCode = 1; - else if (indexData.m_frameLen < 262144) - endCode = 2; - else if (indexData.m_frameLen < 393216) - endCode = 3; - else if (indexData.m_frameLen < 589824) - endCode = 4; - else if (indexData.m_frameLen < 917504) - endCode = 5; - else if (indexData.m_frameLen < 1310720) - endCode = 6; - else - endCode = 7; - } + if (V3_flags) { + if (indexData.m_frameLen < 786432) + endCode = 1; + else if (indexData.m_frameLen < 1572864) + endCode = 2; + else if (indexData.m_frameLen < 2359296) + endCode = 3; + else if (indexData.m_frameLen < 3145728) + endCode = 4; + else if (indexData.m_frameLen < 3932160) + endCode = 5; + else if (indexData.m_frameLen < 4718592) + endCode = 6; + else + endCode = 7; + } + else { + if (indexData.m_frameLen < 131072) + endCode = 1; + else if (indexData.m_frameLen < 262144) + endCode = 2; + else if (indexData.m_frameLen < 393216) + endCode = 3; + else if (indexData.m_frameLen < 589824) + endCode = 4; + else if (indexData.m_frameLen < 917504) + endCode = 5; + else if (indexData.m_frameLen < 1310720) + endCode = 6; + else + endCode = 7; + } writer.putBits(3, endCode); //I_end_position_offset[EP_fine_id] 3 bslbf writer.putBits(11, (itr->first >> 9) % 2048); //PTS_EP_fine[EP_fine_id] 11 uimsbf writer.putBits(17, indexData.m_pktCnt % (65536*2)); //SPN_EP_fine[EP_fine_id] 17 uimsbf From 410a170a5b1ac26e817149180654b02235c44c2d Mon Sep 17 00:00:00 2001 From: Jean Christophe DE RYCK Date: Mon, 6 Jan 2020 19:24:56 +0200 Subject: [PATCH 2/2] Correction to I_end patch --- tsMuxer/tsPacket.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tsMuxer/tsPacket.cpp b/tsMuxer/tsPacket.cpp index e1584551..f1629b95 100644 --- a/tsMuxer/tsPacket.cpp +++ b/tsMuxer/tsPacket.cpp @@ -994,6 +994,7 @@ void CLPIParser::composeEP_map_for_one_stream_PID(BitStreamWriter& writer, M2TSS else endCode = 7; } + } writer.putBits(3, endCode); //I_end_position_offset[EP_fine_id] 3 bslbf writer.putBits(11, (itr->first >> 9) % 2048); //PTS_EP_fine[EP_fine_id] 11 uimsbf writer.putBits(17, indexData.m_pktCnt % (65536*2)); //SPN_EP_fine[EP_fine_id] 17 uimsbf