]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_fieldorder.c
vaapi_h265: cu_qp_delta should not be used in constant-QP mode
[ffmpeg] / libavfilter / vf_fieldorder.c
index 2918cd897b468dd7f5530309e33ba7ee5b26f6d4..dd4f8cc69416fed9a98ca6ea4ca79538f6caee12 100644 (file)
@@ -35,7 +35,7 @@
 #include "internal.h"
 #include "video.h"
 
-typedef struct {
+typedef struct FieldOrderContext {
     const AVClass *class;
     int dst_tff;               ///< output bff/tff
     int          line_size[4]; ///< bytes of pixel data per line for each plane
@@ -50,9 +50,10 @@ static int query_formats(AVFilterContext *ctx)
     /** accept any input pixel format that is not hardware accelerated, not
      *  a bitstream format, and does not have vertically sub-sampled chroma */
     if (ctx->inputs[0]) {
+        const AVPixFmtDescriptor *desc = NULL;
         formats = NULL;
-        for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) {
-            const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+        while ((desc = av_pix_fmt_desc_next(desc))) {
+            pix_fmt = av_pix_fmt_desc_get_id(desc);
             if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL ||
                   desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) &&
                 desc->nb_components && !desc->log2_chroma_h &&
@@ -70,30 +71,20 @@ static int query_formats(AVFilterContext *ctx)
 
 static int config_input(AVFilterLink *inlink)
 {
-    AVFilterContext   *ctx        = inlink->dst;
-    FieldOrderContext *fieldorder = ctx->priv;
+    AVFilterContext   *ctx = inlink->dst;
+    FieldOrderContext *s   = ctx->priv;
     int               plane;
 
     /** full an array with the number of bytes that the video
      *  data occupies per line for each plane of the input video */
     for (plane = 0; plane < 4; plane++) {
-        fieldorder->line_size[plane] = av_image_get_linesize(
-                inlink->format,
-                inlink->w,
-                plane);
+        s->line_size[plane] = av_image_get_linesize(inlink->format, inlink->w,
+                                                    plane);
     }
 
     return 0;
 }
 
-static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
-{
-    AVFilterContext   *ctx        = inlink->dst;
-    AVFilterLink      *outlink    = ctx->outputs[0];
-
-    return ff_get_video_buffer(outlink, w, h);
-}
-
 static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 {
     AVFilterContext   *ctx     = inlink->dst;
@@ -103,10 +94,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
     uint8_t *data;
 
     if (!frame->interlaced_frame ||
-        frame->top_field_first == s->dst_tff)
+        frame->top_field_first == s->dst_tff) {
+        av_log(ctx, AV_LOG_VERBOSE,
+               "Skipping %s.\n",
+               frame->interlaced_frame ?
+               "frame with same field order" : "progressive frame");
         return ff_filter_frame(outlink, frame);
+    }
 
-    av_dlog(ctx,
+    av_log(ctx, AV_LOG_TRACE,
             "picture will move %s one line\n",
             s->dst_tff ? "up" : "down");
     h = frame->height;
@@ -171,7 +167,6 @@ static const AVFilterPad avfilter_vf_fieldorder_inputs[] = {
         .name             = "default",
         .type             = AVMEDIA_TYPE_VIDEO,
         .config_props     = config_input,
-        .get_video_buffer = get_video_buffer,
         .filter_frame     = filter_frame,
         .needs_writable   = 1,
     },
@@ -186,7 +181,7 @@ static const AVFilterPad avfilter_vf_fieldorder_outputs[] = {
     { NULL }
 };
 
-AVFilter avfilter_vf_fieldorder = {
+AVFilter ff_vf_fieldorder = {
     .name          = "fieldorder",
     .description   = NULL_IF_CONFIG_SMALL("Set the field order."),
     .priv_size     = sizeof(FieldOrderContext),