]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264_parser.c
vaapi_encode: Refactor slightly to allow easier setting of global options
[ffmpeg] / libavcodec / h264_parser.c
index e6528060f76d3d18b3ea88eba95fe9a45af1035f..b5ccce342502ea0f978c327eff04e149e4c0134f 100644 (file)
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
 
-#include "libavutil/attributes.h"
-#include "parser.h"
-#include "h264data.h"
+#include <assert.h>
+#include <stdint.h>
+
+#include "libavutil/avutil.h"
+#include "libavutil/error.h"
+#include "libavutil/log.h"
+#include "libavutil/mem.h"
+#include "libavutil/pixfmt.h"
+
+#include "get_bits.h"
 #include "golomb.h"
+#include "h264.h"
+#include "h264data.h"
 #include "internal.h"
 #include "mpegutils.h"
-
-#include <assert.h>
+#include "parser.h"
 
 typedef struct H264ParseContext {
     H264Context h;
@@ -142,7 +150,8 @@ static int scan_mmco_reset(AVCodecParserContext *s)
 
     if ((h->pps.weighted_pred && sl->slice_type_nos == AV_PICTURE_TYPE_P) ||
         (h->pps.weighted_bipred_idc == 1 && sl->slice_type_nos == AV_PICTURE_TYPE_B))
-        ff_pred_weight_table(h, sl);
+        ff_h264_pred_weight_table(&sl->gb, &h->sps, sl->ref_count, sl->slice_type_nos,
+                                  &sl->pwt);
 
     if (get_bits1(&sl->gb)) { // adaptive_ref_pic_marking_mode_flag
         int i;
@@ -226,7 +235,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
             }
             break;
         }
-        ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
+        ptr = ff_h264_decode_nal(h, sl, buf, &dst_length, &consumed, src_length);
         if (!ptr || dst_length < 0)
             break;
 
@@ -253,7 +262,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
             init_get_bits(&sl->gb, ptr, 8 * dst_length);
             get_ue_golomb(&sl->gb);  // skip first_mb_in_slice
             slice_type   = get_ue_golomb_31(&sl->gb);
-            s->pict_type = golomb_to_pict_type[slice_type % 5];
+            s->pict_type = ff_h264_golomb_to_pict_type[slice_type % 5];
             if (h->sei_recovery_frame_cnt >= 0) {
                 /* key frame, since recovery_frame_cnt is set */
                 s->key_frame = 1;
@@ -532,7 +541,7 @@ static int h264_split(AVCodecContext *avctx,
     return 0;
 }
 
-static void close(AVCodecParserContext *s)
+static void h264_close(AVCodecParserContext *s)
 {
     H264ParseContext *p = s->priv_data;
     H264Context      *h = &p->h;
@@ -552,7 +561,6 @@ static av_cold int init(AVCodecParserContext *s)
         return 0;
     h->nb_slice_ctx = 1;
 
-    h->thread_context[0]   = h;
     h->slice_context_count = 1;
     ff_h264dsp_init(&h->h264dsp, 8, 1);
     return 0;
@@ -563,6 +571,6 @@ AVCodecParser ff_h264_parser = {
     .priv_data_size = sizeof(H264ParseContext),
     .parser_init    = init,
     .parser_parse   = h264_parse,
-    .parser_close   = close,
+    .parser_close   = h264_close,
     .split          = h264_split,
 };