hevc_parse: rename into h2645_parse
authorAnton Khirnov <anton@khirnov.net>
Mon, 21 Mar 2016 06:26:42 +0000 (07:26 +0100)
committerAnton Khirnov <anton@khirnov.net>
Mon, 28 Mar 2016 07:42:44 +0000 (09:42 +0200)
This code will be shared with h264.

libavcodec/Makefile
libavcodec/h2645_parse.c [new file with mode: 0644]
libavcodec/h2645_parse.h [new file with mode: 0644]
libavcodec/hevc.c
libavcodec/hevc.h
libavcodec/hevc_parse.c [deleted file]
libavcodec/hevc_parser.c
libavcodec/qsvenc_hevc.c

index f484180..e253e7e 100644 (file)
@@ -261,10 +261,10 @@ OBJS-$(CONFIG_HAP_DECODER)             += hapdec.o hap.o
 OBJS-$(CONFIG_HAP_ENCODER)             += hapenc.o hap.o
 OBJS-$(CONFIG_HEVC_DECODER)            += hevc.o hevc_mvs.o hevc_ps.o hevc_sei.o \
                                           hevc_cabac.o hevc_refs.o hevcpred.o    \
-                                          hevcdsp.o hevc_filter.o hevc_parse.o hevc_data.o
+                                          hevcdsp.o hevc_filter.o h2645_parse.o hevc_data.o
 OBJS-$(CONFIG_HEVC_NVENC_ENCODER)      += nvenc_hevc.o
 OBJS-$(CONFIG_HEVC_QSV_DECODER)        += qsvdec_h2645.o
-OBJS-$(CONFIG_HEVC_QSV_ENCODER)        += qsvenc_hevc.o hevc_ps_enc.o hevc_parse.o
+OBJS-$(CONFIG_HEVC_QSV_ENCODER)        += qsvenc_hevc.o hevc_ps_enc.o h2645_parse.o
 OBJS-$(CONFIG_HNM4_VIDEO_DECODER)      += hnm4video.o
 OBJS-$(CONFIG_HQ_HQA_DECODER)          += hq_hqa.o hq_hqadata.o hq_hqadsp.o \
                                           canopus.o
@@ -719,7 +719,7 @@ OBJS-$(CONFIG_GSM_PARSER)              += gsm_parser.o
 OBJS-$(CONFIG_H261_PARSER)             += h261_parser.o
 OBJS-$(CONFIG_H263_PARSER)             += h263_parser.o
 OBJS-$(CONFIG_H264_PARSER)             += h264_parser.o
-OBJS-$(CONFIG_HEVC_PARSER)             += hevc_parser.o hevc_parse.o hevc_ps.o hevc_data.o
+OBJS-$(CONFIG_HEVC_PARSER)             += hevc_parser.o h2645_parse.o hevc_ps.o hevc_data.o
 OBJS-$(CONFIG_MJPEG_PARSER)            += mjpeg_parser.o
 OBJS-$(CONFIG_MLP_PARSER)              += mlp_parser.o mlp.o
 OBJS-$(CONFIG_MPEG4VIDEO_PARSER)       += mpeg4video_parser.o h263.o \
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
new file mode 100644 (file)
index 0000000..794c954
--- /dev/null
@@ -0,0 +1,228 @@
+/*
+ * H.264/HEVC common parsing code
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <string.h>
+
+#include "config.h"
+
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
+
+#include "h2645_parse.h"
+
+/* FIXME: This is adapted from ff_h264_decode_nal, avoiding duplication
+ * between these functions would be nice. */
+int ff_h2645_extract_rbsp(const uint8_t *src, int length,
+                          H2645NAL *nal)
+{
+    int i, si, di;
+    uint8_t *dst;
+
+#define STARTCODE_TEST                                                  \
+        if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) {     \
+            if (src[i + 2] != 3) {                                      \
+                /* startcode, so we must be past the end */             \
+                length = i;                                             \
+            }                                                           \
+            break;                                                      \
+        }
+#if HAVE_FAST_UNALIGNED
+#define FIND_FIRST_ZERO                                                 \
+        if (i > 0 && !src[i])                                           \
+            i--;                                                        \
+        while (src[i])                                                  \
+            i++
+#if HAVE_FAST_64BIT
+    for (i = 0; i + 1 < length; i += 9) {
+        if (!((~AV_RN64A(src + i) &
+               (AV_RN64A(src + i) - 0x0100010001000101ULL)) &
+              0x8000800080008080ULL))
+            continue;
+        FIND_FIRST_ZERO;
+        STARTCODE_TEST;
+        i -= 7;
+    }
+#else
+    for (i = 0; i + 1 < length; i += 5) {
+        if (!((~AV_RN32A(src + i) &
+               (AV_RN32A(src + i) - 0x01000101U)) &
+              0x80008080U))
+            continue;
+        FIND_FIRST_ZERO;
+        STARTCODE_TEST;
+        i -= 3;
+    }
+#endif /* HAVE_FAST_64BIT */
+#else
+    for (i = 0; i + 1 < length; i += 2) {
+        if (src[i])
+            continue;
+        if (i > 0 && src[i - 1] == 0)
+            i--;
+        STARTCODE_TEST;
+    }
+#endif /* HAVE_FAST_UNALIGNED */
+
+    if (i >= length - 1) { // no escaped 0
+        nal->data     =
+        nal->raw_data = src;
+        nal->size     =
+        nal->raw_size = length;
+        return length;
+    }
+
+    av_fast_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size,
+                   length + AV_INPUT_BUFFER_PADDING_SIZE);
+    if (!nal->rbsp_buffer)
+        return AVERROR(ENOMEM);
+
+    dst = nal->rbsp_buffer;
+
+    memcpy(dst, src, i);
+    si = di = i;
+    while (si + 2 < length) {
+        // remove escapes (very rare 1:2^22)
+        if (src[si + 2] > 3) {
+            dst[di++] = src[si++];
+            dst[di++] = src[si++];
+        } else if (src[si] == 0 && src[si + 1] == 0) {
+            if (src[si + 2] == 3) { // escape
+                dst[di++] = 0;
+                dst[di++] = 0;
+                si       += 3;
+
+                continue;
+            } else // next start code
+                goto nsc;
+        }
+
+        dst[di++] = src[si++];
+    }
+    while (si < length)
+        dst[di++] = src[si++];
+
+nsc:
+    memset(dst + di, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+
+    nal->data = dst;
+    nal->size = di;
+    nal->raw_data = src;
+    nal->raw_size = si;
+    return si;
+}
+
+/**
+ * @return AVERROR_INVALIDDATA if the packet is not a valid NAL unit,
+ * 0 if the unit should be skipped, 1 otherwise
+ */
+static int hevc_parse_nal_header(H2645NAL *nal, AVCodecContext *avctx)
+{
+    GetBitContext *gb = &nal->gb;
+    int nuh_layer_id;
+
+    if (get_bits1(gb) != 0)
+        return AVERROR_INVALIDDATA;
+
+    nal->type = get_bits(gb, 6);
+
+    nuh_layer_id   = get_bits(gb, 6);
+    nal->temporal_id = get_bits(gb, 3) - 1;
+    if (nal->temporal_id < 0)
+        return AVERROR_INVALIDDATA;
+
+    av_log(avctx, AV_LOG_DEBUG,
+           "nal_unit_type: %d, nuh_layer_id: %dtemporal_id: %d\n",
+           nal->type, nuh_layer_id, nal->temporal_id);
+
+    return nuh_layer_id == 0;
+}
+
+
+int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
+                          AVCodecContext *avctx, int is_nalff, int nal_length_size)
+{
+    int consumed, ret = 0;
+
+    pkt->nb_nals = 0;
+    while (length >= 4) {
+        H2645NAL *nal;
+        int extract_length = 0;
+
+        if (is_nalff) {
+            int i;
+            for (i = 0; i < nal_length_size; i++)
+                extract_length = (extract_length << 8) | buf[i];
+            buf    += nal_length_size;
+            length -= nal_length_size;
+
+            if (extract_length > length) {
+                av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit size.\n");
+                return AVERROR_INVALIDDATA;
+            }
+        } else {
+            if (buf[2] == 0) {
+                length--;
+                buf++;
+                continue;
+            }
+            if (buf[0] != 0 || buf[1] != 0 || buf[2] != 1)
+                return AVERROR_INVALIDDATA;
+
+            buf           += 3;
+            length        -= 3;
+            extract_length = length;
+        }
+
+        if (pkt->nals_allocated < pkt->nb_nals + 1) {
+            int new_size = pkt->nals_allocated + 1;
+            H2645NAL *tmp = av_realloc_array(pkt->nals, new_size, sizeof(*tmp));
+            if (!tmp)
+                return AVERROR(ENOMEM);
+
+            pkt->nals = tmp;
+            memset(pkt->nals + pkt->nals_allocated, 0,
+                   (new_size - pkt->nals_allocated) * sizeof(*tmp));
+            pkt->nals_allocated = new_size;
+        }
+        nal = &pkt->nals[pkt->nb_nals++];
+
+        consumed = ff_h2645_extract_rbsp(buf, extract_length, nal);
+        if (consumed < 0)
+            return consumed;
+
+        ret = init_get_bits8(&nal->gb, nal->data, nal->size);
+        if (ret < 0)
+            return ret;
+
+        ret = hevc_parse_nal_header(nal, avctx);
+        if (ret <= 0) {
+            if (ret < 0) {
+                av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
+                       nal->type);
+            }
+            pkt->nb_nals--;
+        }
+
+        buf    += consumed;
+        length -= consumed;
+    }
+
+    return 0;
+}
diff --git a/libavcodec/h2645_parse.h b/libavcodec/h2645_parse.h
new file mode 100644 (file)
index 0000000..4901ccf
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * H.264/HEVC common parsing code
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_H2645_PARSE_H
+#define AVCODEC_H2645_PARSE_H
+
+#include <stdint.h>
+
+#include "avcodec.h"
+#include "get_bits.h"
+
+typedef struct H2645NAL {
+    uint8_t *rbsp_buffer;
+    int rbsp_buffer_size;
+
+    int size;
+    const uint8_t *data;
+
+    int raw_size;
+    const uint8_t *raw_data;
+
+    GetBitContext gb;
+
+    int type;
+    int temporal_id;
+} H2645NAL;
+
+/* an input packet split into unescaped NAL units */
+typedef struct H2645Packet {
+    H2645NAL *nals;
+    int nb_nals;
+    int nals_allocated;
+} H2645Packet;
+
+/**
+ * Extract the raw (unescaped) bitstream.
+ */
+int ff_h2645_extract_rbsp(const uint8_t *src, int length,
+                          H2645NAL *nal);
+
+/**
+ * Split an input packet into NAL units.
+ */
+int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
+                          AVCodecContext *avctx, int is_nalff, int nal_length_size);
+
+#endif /* AVCODEC_H2645_PARSE_H */
index a5a525a..69c4f26 100644 (file)
@@ -2429,7 +2429,7 @@ fail:
     return ret;
 }
 
-static int decode_nal_unit(HEVCContext *s, const HEVCNAL *nal)
+static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
 {
     HEVCLocalContext *lc = &s->HEVClc;
     GetBitContext *gb    = &lc->gb;
@@ -2581,8 +2581,8 @@ 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->pkt, buf, length, s->avctx, s->is_nalff,
-                               s->nal_length_size);
+    ret = ff_h2645_packet_split(&s->pkt, buf, length, s->avctx, s->is_nalff,
+                                s->nal_length_size);
     if (ret < 0) {
         av_log(s->avctx, AV_LOG_ERROR,
                "Error splitting the input into NAL units.\n");
index 1860bf5..d15af71 100644 (file)
@@ -33,6 +33,7 @@
 #include "bswapdsp.h"
 #include "cabac.h"
 #include "get_bits.h"
+#include "h2645_parse.h"
 #include "hevcdsp.h"
 #include "internal.h"
 #include "thread.h"
@@ -704,29 +705,6 @@ typedef struct HEVCFrame {
     uint8_t flags;
 } HEVCFrame;
 
-typedef struct HEVCNAL {
-    uint8_t *rbsp_buffer;
-    int rbsp_buffer_size;
-
-    int size;
-    const uint8_t *data;
-
-    int raw_size;
-    const uint8_t *raw_data;
-
-    GetBitContext gb;
-
-    enum NALUnitType type;
-    int temporal_id;
-} HEVCNAL;
-
-/* an input packet split into unescaped NAL units */
-typedef struct HEVCPacket {
-    HEVCNAL *nals;
-    int nb_nals;
-    int nals_allocated;
-} HEVCPacket;
-
 struct HEVCContext;
 
 typedef struct HEVCPredContext {
@@ -852,7 +830,7 @@ typedef struct HEVCContext {
     uint16_t seq_decode;
     uint16_t seq_output;
 
-    HEVCPacket pkt;
+    H2645Packet pkt;
     // type of the first VCL NAL of the current frame
     enum NALUnitType first_nal_type;
 
@@ -1023,18 +1001,6 @@ void ff_hevc_pps_free(HEVCPPS **ppps);
 
 void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth);
 
-/**
- * Extract the raw (unescaped) HEVC bitstream.
- */
-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(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,
                            uint8_t *buf, int buf_size);
 
diff --git a/libavcodec/hevc_parse.c b/libavcodec/hevc_parse.c
deleted file mode 100644 (file)
index de00245..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * HEVC common code
- *
- * This file is part of Libav.
- *
- * Libav is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * Libav is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <string.h>
-
-#include "config.h"
-
-#include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
-
-#include "hevc.h"
-
-/* FIXME: This is adapted from ff_h264_decode_nal, avoiding duplication
- * between these functions would be nice. */
-int ff_hevc_extract_rbsp(const uint8_t *src, int length,
-                         HEVCNAL *nal)
-{
-    int i, si, di;
-    uint8_t *dst;
-
-#define STARTCODE_TEST                                                  \
-        if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) {     \
-            if (src[i + 2] != 3) {                                      \
-                /* startcode, so we must be past the end */             \
-                length = i;                                             \
-            }                                                           \
-            break;                                                      \
-        }
-#if HAVE_FAST_UNALIGNED
-#define FIND_FIRST_ZERO                                                 \
-        if (i > 0 && !src[i])                                           \
-            i--;                                                        \
-        while (src[i])                                                  \
-            i++
-#if HAVE_FAST_64BIT
-    for (i = 0; i + 1 < length; i += 9) {
-        if (!((~AV_RN64A(src + i) &
-               (AV_RN64A(src + i) - 0x0100010001000101ULL)) &
-              0x8000800080008080ULL))
-            continue;
-        FIND_FIRST_ZERO;
-        STARTCODE_TEST;
-        i -= 7;
-    }
-#else
-    for (i = 0; i + 1 < length; i += 5) {
-        if (!((~AV_RN32A(src + i) &
-               (AV_RN32A(src + i) - 0x01000101U)) &
-              0x80008080U))
-            continue;
-        FIND_FIRST_ZERO;
-        STARTCODE_TEST;
-        i -= 3;
-    }
-#endif /* HAVE_FAST_64BIT */
-#else
-    for (i = 0; i + 1 < length; i += 2) {
-        if (src[i])
-            continue;
-        if (i > 0 && src[i - 1] == 0)
-            i--;
-        STARTCODE_TEST;
-    }
-#endif /* HAVE_FAST_UNALIGNED */
-
-    if (i >= length - 1) { // no escaped 0
-        nal->data     =
-        nal->raw_data = src;
-        nal->size     =
-        nal->raw_size = length;
-        return length;
-    }
-
-    av_fast_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size,
-                   length + AV_INPUT_BUFFER_PADDING_SIZE);
-    if (!nal->rbsp_buffer)
-        return AVERROR(ENOMEM);
-
-    dst = nal->rbsp_buffer;
-
-    memcpy(dst, src, i);
-    si = di = i;
-    while (si + 2 < length) {
-        // remove escapes (very rare 1:2^22)
-        if (src[si + 2] > 3) {
-            dst[di++] = src[si++];
-            dst[di++] = src[si++];
-        } else if (src[si] == 0 && src[si + 1] == 0) {
-            if (src[si + 2] == 3) { // escape
-                dst[di++] = 0;
-                dst[di++] = 0;
-                si       += 3;
-
-                continue;
-            } else // next start code
-                goto nsc;
-        }
-
-        dst[di++] = src[si++];
-    }
-    while (si < length)
-        dst[di++] = src[si++];
-
-nsc:
-    memset(dst + di, 0, AV_INPUT_BUFFER_PADDING_SIZE);
-
-    nal->data = dst;
-    nal->size = di;
-    nal->raw_data = src;
-    nal->raw_size = si;
-    return si;
-}
-
-/**
- * @return AVERROR_INVALIDDATA if the packet is not a valid NAL unit,
- * 0 if the unit should be skipped, 1 otherwise
- */
-static int hls_nal_unit(HEVCNAL *nal, AVCodecContext *avctx)
-{
-    GetBitContext *gb = &nal->gb;
-    int nuh_layer_id;
-
-    if (get_bits1(gb) != 0)
-        return AVERROR_INVALIDDATA;
-
-    nal->type = get_bits(gb, 6);
-
-    nuh_layer_id   = get_bits(gb, 6);
-    nal->temporal_id = get_bits(gb, 3) - 1;
-    if (nal->temporal_id < 0)
-        return AVERROR_INVALIDDATA;
-
-    av_log(avctx, AV_LOG_DEBUG,
-           "nal_unit_type: %d, nuh_layer_id: %dtemporal_id: %d\n",
-           nal->type, nuh_layer_id, nal->temporal_id);
-
-    return nuh_layer_id == 0;
-}
-
-
-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;
-
-    pkt->nb_nals = 0;
-    while (length >= 4) {
-        HEVCNAL *nal;
-        int extract_length = 0;
-
-        if (is_nalff) {
-            int i;
-            for (i = 0; i < nal_length_size; i++)
-                extract_length = (extract_length << 8) | buf[i];
-            buf    += nal_length_size;
-            length -= nal_length_size;
-
-            if (extract_length > length) {
-                av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit size.\n");
-                return AVERROR_INVALIDDATA;
-            }
-        } else {
-            if (buf[2] == 0) {
-                length--;
-                buf++;
-                continue;
-            }
-            if (buf[0] != 0 || buf[1] != 0 || buf[2] != 1)
-                return AVERROR_INVALIDDATA;
-
-            buf           += 3;
-            length        -= 3;
-            extract_length = length;
-        }
-
-        if (pkt->nals_allocated < pkt->nb_nals + 1) {
-            int new_size = pkt->nals_allocated + 1;
-            HEVCNAL *tmp = av_realloc_array(pkt->nals, new_size, sizeof(*tmp));
-            if (!tmp)
-                return AVERROR(ENOMEM);
-
-            pkt->nals = tmp;
-            memset(pkt->nals + pkt->nals_allocated, 0,
-                   (new_size - pkt->nals_allocated) * sizeof(*tmp));
-            pkt->nals_allocated = new_size;
-        }
-        nal = &pkt->nals[pkt->nb_nals++];
-
-        consumed = ff_hevc_extract_rbsp(buf, extract_length, nal);
-        if (consumed < 0)
-            return consumed;
-
-        ret = init_get_bits8(&nal->gb, nal->data, nal->size);
-        if (ret < 0)
-            return ret;
-
-        ret = hls_nal_unit(nal, avctx);
-        if (ret <= 0) {
-            if (ret < 0) {
-                av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
-                       nal->type);
-            }
-            pkt->nb_nals--;
-        }
-
-        buf    += consumed;
-        length -= consumed;
-    }
-
-    return 0;
-}
index 030163e..20eae54 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "golomb.h"
 #include "hevc.h"
+#include "h2645_parse.h"
 #include "parser.h"
 
 #define START_CODE 0x000001 ///< start_code_prefix_one_3bytes
 typedef struct HEVCParserContext {
     ParseContext pc;
 
-    HEVCPacket pkt;
+    H2645Packet pkt;
     HEVCParamSets ps;
 
     int parsed_extradata;
 } HEVCParserContext;
 
-static int hevc_parse_slice_header(AVCodecParserContext *s, HEVCNAL *nal,
+static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal,
                                    AVCodecContext *avctx)
 {
     HEVCParserContext *ctx = s->priv_data;
@@ -81,12 +82,12 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
     HEVCParserContext *ctx = s->priv_data;
     int ret, i;
 
-    ret = ff_hevc_split_packet(&ctx->pkt, buf, buf_size, avctx, 0, 0);
+    ret = ff_h2645_packet_split(&ctx->pkt, buf, buf_size, avctx, 0, 0);
     if (ret < 0)
         return ret;
 
     for (i = 0; i < ctx->pkt.nb_nals; i++) {
-        HEVCNAL *nal = &ctx->pkt.nals[i];
+        H2645NAL *nal = &ctx->pkt.nals[i];
 
         /* ignore everything except parameter sets and VCL NALUs */
         switch (nal->type) {
index 8884e24..706191d 100644 (file)
@@ -31,6 +31,7 @@
 #include "bytestream.h"
 #include "get_bits.h"
 #include "hevc.h"
+#include "h2645_parse.h"
 #include "internal.h"
 #include "qsv.h"
 #include "qsv_internal.h"
@@ -54,7 +55,7 @@ static int generate_fake_vps(QSVEncContext *q, AVCodecContext *avctx)
     PutByteContext pbc;
 
     GetBitContext gb;
-    HEVCNAL sps_nal = { NULL };
+    H2645NAL sps_nal = { NULL };
     HEVCSPS sps = { 0 };
     HEVCVPS vps = { 0 };
     uint8_t vps_buf[128], vps_rbsp_buf[128];
@@ -68,7 +69,7 @@ static int generate_fake_vps(QSVEncContext *q, AVCodecContext *avctx)
     }
 
     /* parse the SPS */
-    ret = ff_hevc_extract_rbsp(avctx->extradata + 4, avctx->extradata_size - 4, &sps_nal);
+    ret = ff_h2645_extract_rbsp(avctx->extradata + 4, avctx->extradata_size - 4, &sps_nal);
     if (ret < 0) {
         av_log(avctx, AV_LOG_ERROR, "Error unescaping the SPS buffer\n");
         return ret;