History

cbs_h265: add raw filler encoding

Dave Airlie committed 3 years ago

Commit b4283f91 parent 12f158c3 files · +52 −0Browse files

Showing the changes to libavcodec (3 of 3 files). Show all

Unified · Split

3 files
  1. libavcodec/cbs_h2645.c +17 −0
  2. libavcodec/cbs_h265.h +6 −0
  3. libavcodec/cbs_h265_syntax_template.c +29 −0
libavcodec/cbs_h2645.c+17−0
@@ -1055,6 +1055,14 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx, · 1054 unmodified lines
1055 }1055 }
1056 break;1056 break;
1057 1057
1058 case HEVC_NAL_FD_NUT:
1059 {
1060 err = cbs_h265_read_filler(ctx, &gbc, unit->content);
1061 if (err < 0)
1062 return err;
1063 }
1064 break;
1065
1058 case HEVC_NAL_SEI_PREFIX:1066 case HEVC_NAL_SEI_PREFIX:
1059 case HEVC_NAL_SEI_SUFFIX:1067 case HEVC_NAL_SEI_SUFFIX:
1060 {1068 {
@@ -1497,6 +1505,14 @@ static int cbs_h265_write_nal_unit(CodedBitstreamContext *ctx, · 436 unmodified lines
1497 }1505 }
1498 break;1506 break;
1499 1507
1508 case HEVC_NAL_FD_NUT:
1509 {
1510 err = cbs_h265_write_filler(ctx, pbc, unit->content);
1511 if (err < 0)
1512 return err;
1513 }
1514 break;
1515
1500 case HEVC_NAL_SEI_PREFIX:1516 case HEVC_NAL_SEI_PREFIX:
1501 case HEVC_NAL_SEI_SUFFIX:1517 case HEVC_NAL_SEI_SUFFIX:
1502 {1518 {
@@ -2006,6 +2022,7 @@ static const CodedBitstreamUnitTypeDescriptor cbs_h265_unit_types[] = { · 503 unmodified lines
2006 CBS_UNIT_TYPE_INTERNAL_REF(HEVC_NAL_PPS, H265RawPPS, extension_data.data),2022 CBS_UNIT_TYPE_INTERNAL_REF(HEVC_NAL_PPS, H265RawPPS, extension_data.data),
2007 2023
2008 CBS_UNIT_TYPE_POD(HEVC_NAL_AUD, H265RawAUD),2024 CBS_UNIT_TYPE_POD(HEVC_NAL_AUD, H265RawAUD),
2025 CBS_UNIT_TYPE_POD(HEVC_NAL_FD_NUT, H265RawFiller),
2009 2026
2010 // Slices of non-IRAP pictures.2027 // Slices of non-IRAP pictures.
2011 CBS_UNIT_RANGE_INTERNAL_REF(HEVC_NAL_TRAIL_N, HEVC_NAL_RASL_R,2028 CBS_UNIT_RANGE_INTERNAL_REF(HEVC_NAL_TRAIL_N, HEVC_NAL_RASL_R,
libavcodec/cbs_h265.h+6−0
@@ -741,6 +741,12 @@ typedef struct H265RawSEI { · 740 unmodified lines
741 SEIRawMessageList message_list;741 SEIRawMessageList message_list;
742} H265RawSEI;742} H265RawSEI;
743 743
744typedef struct H265RawFiller {
745 H265RawNALUnitHeader nal_unit_header;
746
747 uint32_t filler_size;
748} H265RawFiller;
749
744typedef struct CodedBitstreamH265Context {750typedef struct CodedBitstreamH265Context {
745 // Reader/writer context in common with the H.264 implementation.751 // Reader/writer context in common with the H.264 implementation.
746 CodedBitstreamH2645Context common;752 CodedBitstreamH2645Context common;
libavcodec/cbs_h265_syntax_template.c+29−0
@@ -2364,3 +2364,32 @@ static int FUNC(sei)(CodedBitstreamContext *ctx, RWContext *rw, · 2363 unmodified lines
2364 2364
2365 return 0;2365 return 0;
2366}2366}
2367
2368
2369static int FUNC(filler)(CodedBitstreamContext *ctx, RWContext *rw,
2370 H265RawFiller *current)
2371{
2372 int err;
2373
2374 HEADER("Filler Data");
2375
2376 CHECK(FUNC(nal_unit_header)(ctx, rw, &current->nal_unit_header,
2377 HEVC_NAL_FD_NUT));
2378
2379#ifdef READ
2380 while (show_bits(rw, 8) == 0xff) {
2381 fixed(8, ff_byte, 0xff);
2382 ++current->filler_size;
2383 }
2384#else
2385 {
2386 uint32_t i;
2387 for (i = 0; i < current->filler_size; i++)
2388 fixed(8, ff_byte, 0xff);
2389 }
2390#endif
2391
2392 CHECK(FUNC(rbsp_trailing_bits)(ctx, rw));
2393
2394 return 0;
2395}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t