Skip to content

Commit

Permalink
debug h264
Browse files Browse the repository at this point in the history
  • Loading branch information
penndev committed Nov 18, 2024
1 parent f2794bc commit ac6c5ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Media/h26x_example/H264_mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def get_intra_chroma_pred_mode(self):
return synElVal

def mb_pred(self):
if self.mb_type.MbPartPredMode in ("Intra_4x4", "Intra_8x8" "Intra_16x16" ):
if self.mb_type.MbPartPredMode in ("Intra_4x4", "Intra_8x8", "Intra_16x16"):
if self.mb_type.MbPartPredMode == "Intra_4x4":
self.prev_intra4x4_pred_mode_flag = {}
self.rem_intra4x4_pred_mode = {}
Expand All @@ -183,7 +183,8 @@ def mb_pred(self):
self.prev_intra8x8_pred_mode_flag[luma8x8BlkIdx] = self.stream.cabac_decode(False, ctxIdx = 68)
if not self.prev_intra8x8_pred_mode_flag[luma8x8BlkIdx]:
self.rem_intra8x8_pred_mode[ luma8x8BlkIdx ] = self.stream.cabac_decode(False, ctxIdx = 69)
if self.pps.chroma_format_idc in (1, 2):

if self.sps.chroma_format_idc in (1, 2):
self.intra_chroma_pred_mode = self.get_intra_chroma_pred_mode()

elif self.mb_type.MbPartPredMode != "Direct":
Expand Down
4 changes: 2 additions & 2 deletions Media/h26x_example/h264_nal.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def slice_data(self):
) :
raise('MbaffFrameFlag error')
self.macroblock[self.CurrMbAddr] = MacroBlock(self, self.sps, self.pps, self.stream)
print(self.macroblock[self.CurrMbAddr])
# print(self.macroblock[self.CurrMbAddr].__dict__)
exit(0)
return

Expand Down Expand Up @@ -393,7 +393,7 @@ def __init__(self, stream: BitStream, sps:NAL, pps:NAL):
if self.nal_unit_type == NalUnitType.IDR: # 处理图像帧
self.slice_layer_without_partitioning_rbsp()
elif self.nal_unit_type == NalUnitType.SEI:
print(json.dumps(self.to_dict(), indent=4))
# print(json.dumps(self.to_dict(), indent=4))
return
elif self.nal_unit_type == NalUnitType.SPS: # sps
self.seq_parameter_set_rbsp()
Expand Down
2 changes: 2 additions & 0 deletions Media/h26x_example/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

python .\Media\h26x_example\h264.py

0 comments on commit ac6c5ea

Please sign in to comment.