Skip to content

Commit

Permalink
change: VVC AU sh_picture_header_in_slice_header_flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ireader committed Sep 10, 2023
1 parent fda496d commit ca26a3e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
19 changes: 14 additions & 5 deletions libflv/source/vvc-annexbtomp4.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,18 +388,27 @@ int h266_annexbtomp4(struct mpeg4_vvc_t* vvc, const void* data, size_t bytes, vo
int h266_is_new_access_unit(const uint8_t* nalu, size_t bytes)
{
uint8_t nal_type;
if (bytes < 2)
uint8_t nuh_layer_id;

if (bytes < 3)
return 0;

nal_type = (nalu[1] >> 3) & 0x1f;
nuh_layer_id = nalu[0] & 0x3F;

// 7.4.2.4.3 Order of PUs and their association to AUs
if (H266_NAL_AUD == nal_type || H266_NAL_OPI == nal_type || H266_NAL_DCI == nal_type
|| H266_NAL_VPS == nal_type || H266_NAL_SPS == nal_type || H266_NAL_PPS == nal_type
|| H266_NAL_PREFIX_APS == nal_type || H266_NAL_PH == nal_type || H266_NAL_PREFIX_SEI == nal_type
|| 26 == nal_type || (28 <= nal_type && nal_type <= 29))
if (H266_NAL_AUD == nal_type || H266_NAL_OPI == nal_type || H266_NAL_DCI == nal_type || H266_NAL_VPS == nal_type || H266_NAL_SPS == nal_type || H266_NAL_PPS == nal_type ||
(nuh_layer_id == 0 && (H266_NAL_PREFIX_APS == nal_type || H266_NAL_PH == nal_type || H266_NAL_PREFIX_SEI == nal_type ||
26 == nal_type || (28 <= nal_type && nal_type <= 29))))
return 1;

// 7.4.2.4.4 Order of NAL units and coded pictures and their association to PUs
if (nal_type < H266_NAL_OPI)
{
//sh_picture_header_in_slice_header_flag == 1
return (nalu[2] & 0x80) ? 1 : 0;
}

return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions libflv/test/flv-read-write-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ void flv_read_write_test(const char* flv)
uint32_t timestamp;
while (1 == flv_reader_read(r, &tag, &timestamp, &taglen, packet, sizeof(packet)))
{
if(FLV_TYPE_SCRIPT == tag)
flv_writer_input(w, tag, packet, taglen, timestamp);
ret = flv_demuxer_input(d, tag, packet, taglen, timestamp);
assert(0 == ret);
}
Expand Down
2 changes: 1 addition & 1 deletion libflv/test/flv-reader-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static int onFLV(void* /*param*/, int codec, const void* data, size_t bytes, uin
static uint32_t v_pts = 0, v_dts = 0;
static uint32_t a_pts = 0, a_dts = 0;

printf("[%c] pts: %s, dts: %s, %u, cts: %d, ", flv_type(codec), ftimestamp(pts, s_pts), ftimestamp(dts, s_dts), dts, (int)(pts - dts));
printf("[%c] pts: %s, dts: %s, %u, cts: %d, bytes: %d ", flv_type(codec), ftimestamp(pts, s_pts), ftimestamp(dts, s_dts), dts, (int)(pts - dts), (int)bytes);

if (FLV_AUDIO_AAC == codec)
{
Expand Down
4 changes: 2 additions & 2 deletions libmpeg/source/mpeg-ts-h266.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ static int mpeg_h266_is_new_access_unit(const uint8_t* nalu, size_t bytes)
nuh_layer_id = nalu[0] & 0x3F;

// 7.4.2.4.3 Order of PUs and their association to AUs
if (H266_NAL_OPI == nal_type || H266_NAL_DCI == nal_type || H266_NAL_VPS == nal_type || H266_NAL_SPS == nal_type || H266_NAL_PPS == nal_type ||
(nuh_layer_id == 0 && (H266_NAL_AUD == nal_type || H266_PREFIX_APS_NUT == nal_type || H266_PH_NUT == nal_type || H266_NAL_PREFIX_SEI == nal_type ||
if (H266_NAL_AUD == nal_type || H266_NAL_OPI == nal_type || H266_NAL_DCI == nal_type || H266_NAL_VPS == nal_type || H266_NAL_SPS == nal_type || H266_NAL_PPS == nal_type ||
(nuh_layer_id == 0 && (H266_PREFIX_APS_NUT == nal_type || H266_PH_NUT == nal_type || H266_NAL_PREFIX_SEI == nal_type ||
26 == nal_type || (28 <= nal_type && nal_type <= 29))))
return 1;

Expand Down

0 comments on commit ca26a3e

Please sign in to comment.