diff mbox

[FFmpeg-devel,5/7] avcodec/cbs_h2645: Remove dead code to delete trailing zeroes

Message ID 20191209222604.28920-5-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt Dec. 9, 2019, 10:26 p.m. UTC
Trailing zeroes are already discarded when splitting a fragment, which
makes the code to remove them when decomposing slices dead code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
This of course presupposes that the fragment has been split via
cbs_h2645_split_fragment(). And the current code is buggy even when one
does not make this assumption: The trailing zeroes should be discarded
before one reads the header. And then the GetBitContext needs to
reinitialized (otherwise, some of those trailing zeroes might be
considered valid data when reading the header).

 libavcodec/cbs_h2645.c | 14 --------------
 1 file changed, 14 deletions(-)
diff mbox

Patch

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 7c92ae4871..be82a8cd5f 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -857,13 +857,6 @@  static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
 
             pos = get_bits_count(&gbc);
             len = unit->data_size;
-            if (!unit->data[len - 1]) {
-                int z;
-                for (z = 0; z < len && !unit->data[len - z - 1]; z++);
-                av_log(ctx->log_ctx, AV_LOG_DEBUG, "Deleted %d trailing zeroes "
-                       "from slice data.\n", z);
-                len -= z;
-            }
 
             slice->data_size = len - pos / 8;
             slice->data_ref  = av_buffer_ref(unit->data_ref);
@@ -1039,13 +1032,6 @@  static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
 
             pos = get_bits_count(&gbc);
             len = unit->data_size;
-            if (!unit->data[len - 1]) {
-                int z;
-                for (z = 0; z < len && !unit->data[len - z - 1]; z++);
-                av_log(ctx->log_ctx, AV_LOG_DEBUG, "Deleted %d trailing zeroes "
-                       "from slice data.\n", z);
-                len -= z;
-            }
 
             slice->data_size = len - pos / 8;
             slice->data_ref  = av_buffer_ref(unit->data_ref);