From 9566bb72e3ccfd2f1e07b913eb61367686d9ea9a Mon Sep 17 00:00:00 2001 From: OSAMU WATANABE Date: Mon, 17 Aug 2020 16:42:53 +0900 Subject: [PATCH] Fix incorrect checking of SOP marker segment SOP marker segments may not be present in the codestream even if the second LSB of the SPcod parameter is "1". --- source/Tier2/read_packet.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/Tier2/read_packet.m b/source/Tier2/read_packet.m index 919a687..d8297b2 100644 --- a/source/Tier2/read_packet.m +++ b/source/Tier2/read_packet.m @@ -13,10 +13,15 @@ % if SOP present if codingStyle.is_use_SOP() == true WORD = hDsrc.get_word(); - assert(WORD == x_FF91); - Lsop = hDsrc.get_word(); - assert(Lsop == 4); - Nsop = hDsrc.get_word(); + if WORD == x_FF91 + Lsop = hDsrc.get_word(); + assert(Lsop == 4); + Nsop = hDsrc.get_word(); + else + % SOP may not be present even SPcod says SOP was used + hDsrc.pos = hDsrc.pos - 2; % rewind 2 bytes + % Nsop shall be incremented no matter SOP is present or not + end end %% read packet header