[FFmpeg-devel] [PATCH] lavc/hevc_parse: Don't take a HEVCContext

Derek Buitenhuis derek.buitenhuis at gmail.com
Mon Apr 25 15:41:33 CEST 2016


It's not even used anymore, and the checks are no longer
functionally important.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
---
 libavcodec/hevc.c        |  2 +-
 libavcodec/hevc.h        |  4 ++--
 libavcodec/hevc_parse.c  | 11 +++++------
 libavcodec/hevc_parser.c |  2 +-
 4 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 0d53a33..785aa7e 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2866,7 +2866,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
 
     /* split the input packet into NAL units, so we know the upper bound on the
      * number of slices in the frame */
-    ret = ff_hevc_split_packet(s, &s->pkt, buf, length, s->avctx, s->is_nalff,
+    ret = ff_hevc_split_packet(&s->pkt, buf, length, s->avctx, s->is_nalff,
                                s->nal_length_size);
     if (ret < 0) {
         av_log(s->avctx, AV_LOG_ERROR,
diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index c91f815..5865f65 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -1080,13 +1080,13 @@ void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size);
 /**
  * Extract the raw (unescaped) HEVC bitstream.
  */
-int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length,
+int ff_hevc_extract_rbsp(const uint8_t *src, int length,
                          HEVCNAL *nal);
 
 /**
  * Split an input packet into NAL units.
  */
-int ff_hevc_split_packet(HEVCContext *s, HEVCPacket *pkt, const uint8_t *buf, int length,
+int ff_hevc_split_packet(HEVCPacket *pkt, const uint8_t *buf, int length,
                          AVCodecContext *avctx, int is_nalff, int nal_length_size);
 
 int ff_hevc_encode_nal_vps(HEVCVPS *vps, unsigned int id,
diff --git a/libavcodec/hevc_parse.c b/libavcodec/hevc_parse.c
index d557cc7..6ee8496 100644
--- a/libavcodec/hevc_parse.c
+++ b/libavcodec/hevc_parse.c
@@ -29,14 +29,13 @@
 
 /* FIXME: This is adapted from ff_h264_decode_nal, avoiding duplication
  * between these functions would be nice. */
-int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length,
+int ff_hevc_extract_rbsp(const uint8_t *src, int length,
                          HEVCNAL *nal)
 {
     int i, si, di;
     uint8_t *dst;
 
-    if (s)
-        nal->skipped_bytes = 0;
+    nal->skipped_bytes = 0;
 #define STARTCODE_TEST                                                  \
         if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) {     \
             if (src[i + 2] != 3) {                                      \
@@ -110,7 +109,7 @@ int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length,
                 dst[di++] = 0;
                 si       += 3;
 
-                if (s && nal->skipped_bytes_pos) {
+                if (nal->skipped_bytes_pos) {
                     nal->skipped_bytes++;
                     if (nal->skipped_bytes_pos_size < nal->skipped_bytes) {
                         nal->skipped_bytes_pos_size *= 2;
@@ -205,7 +204,7 @@ static int hls_nal_unit(HEVCNAL *nal, AVCodecContext *avctx)
 }
 
 
-int ff_hevc_split_packet(HEVCContext *s, HEVCPacket *pkt, const uint8_t *buf, int length,
+int ff_hevc_split_packet(HEVCPacket *pkt, const uint8_t *buf, int length,
                          AVCodecContext *avctx, int is_nalff, int nal_length_size)
 {
     int consumed, ret = 0;
@@ -269,7 +268,7 @@ int ff_hevc_split_packet(HEVCContext *s, HEVCPacket *pkt, const uint8_t *buf, in
         }
         nal = &pkt->nals[pkt->nb_nals];
 
-        consumed = ff_hevc_extract_rbsp(s, buf, extract_length, nal);
+        consumed = ff_hevc_extract_rbsp(buf, extract_length, nal);
         if (consumed < 0)
             return consumed;
 
diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
index 4625e61..59893bb 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -239,7 +239,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
                 src_length = 20;
         }
 
-        consumed = ff_hevc_extract_rbsp(NULL, buf, src_length, nal);
+        consumed = ff_hevc_extract_rbsp(buf, src_length, nal);
         if (consumed < 0)
             return consumed;
 
-- 
2.8.1



More information about the ffmpeg-devel mailing list