]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_pp7.c
avformat/mpegtsenc: move is_dvb_subtitle/is_dvb_teletext initialization upwards
[ffmpeg] / libavfilter / vf_pp7.c
index 66979d9a13b4faf1266405c168aef942b238411e..c53a8716cb26fda20912fb6a6e3f868ca74f51b0 100644 (file)
@@ -33,6 +33,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "internal.h"
+#include "qp_table.h"
 #include "vf_pp7.h"
 
 enum mode {
@@ -323,10 +324,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     AVFrame *out = in;
 
     int qp_stride = 0;
-    uint8_t *qp_table = NULL;
+    int8_t *qp_table = NULL;
 
-    if (!pp7->qp)
-        qp_table = av_frame_get_qp_table(in, &qp_stride, &pp7->qscale_type);
+    if (!pp7->qp) {
+        int ret = ff_qp_table_extract(in, &qp_table, &qp_stride, NULL, &pp7->qscale_type);
+        if (ret < 0) {
+            av_frame_free(&in);
+            return ret;
+        }
+    }
 
     if (!ctx->is_disabled) {
         const int cw = AV_CEIL_RSHIFT(inlink->w, pp7->hsub);
@@ -341,6 +347,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             out = ff_get_video_buffer(outlink, aligned_w, aligned_h);
             if (!out) {
                 av_frame_free(&in);
+                av_freep(&qp_table);
                 return AVERROR(ENOMEM);
             }
             av_frame_copy_props(out, in);
@@ -367,6 +374,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
                                 inlink->w, inlink->h);
         av_frame_free(&in);
     }
+    av_freep(&qp_table);
     return ff_filter_frame(outlink, out);
 }
 
@@ -394,7 +402,7 @@ static const AVFilterPad pp7_outputs[] = {
     { NULL }
 };
 
-AVFilter ff_vf_pp7 = {
+const AVFilter ff_vf_pp7 = {
     .name            = "pp7",
     .description     = NULL_IF_CONFIG_SMALL("Apply Postprocessing 7 filter."),
     .priv_size       = sizeof(PP7Context),