From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 0BC03454BC for ; Fri, 26 Apr 2024 12:28:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8DDFE68D435; Fri, 26 Apr 2024 15:28:14 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CC03668D412 for ; Fri, 26 Apr 2024 15:28:06 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1714134486; bh=O9MrkcjVzUDMgn/l+WPChPulp9mqHEJd2RtF4cBMfh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndBNjyoET0lauNZKSYxHCARBnFtsu3x3kpdzDnolouaFN7wIz04c60Im0UfV/szBm wvv7pXJWDksH6XkE6auw07SfGrzt/ujO0NbqrqXUeJPZJ5GdTQ+sxO6S/XY2tdJqbO SOeO2FzWqcnLTGXoyf+RFlKGlkKza0wD87L4nPK8= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 698D440356; Fri, 26 Apr 2024 14:28:06 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Apr 2024 14:27:59 +0200 Message-ID: <20240426122803.19967-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240426122803.19967-1-ffmpeg@haasn.xyz> References: <20240426122803.19967-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/6] avfilter/vf_scale*: strip metadata on size change X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas --- libavfilter/vf_scale.c | 2 ++ libavfilter/vf_scale_cuda.c | 3 +++ libavfilter/vf_scale_npp.c | 3 +++ libavfilter/vf_scale_vaapi.c | 3 +++ libavfilter/vf_scale_vt.c | 3 +++ libavfilter/vf_scale_vulkan.c | 3 +++ 6 files changed, 17 insertions(+) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 1c07daeddf..7b9be039ad 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -870,6 +870,8 @@ scale: out->height = outlink->h; out->color_range = outlink->color_range; out->colorspace = outlink->colorspace; + if (out->width != in->width || out->height != in->height) + av_frame_remove_side_data_changed(out, AV_FRAME_CHANGED_SIZE); if (scale->output_is_pal) avpriv_set_systematic_pal2((uint32_t*)out->data[1], outlink->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : outlink->format); diff --git a/libavfilter/vf_scale_cuda.c b/libavfilter/vf_scale_cuda.c index 5571a52b1e..1e381d6e52 100644 --- a/libavfilter/vf_scale_cuda.c +++ b/libavfilter/vf_scale_cuda.c @@ -525,6 +525,9 @@ static int cudascale_scale(AVFilterContext *ctx, AVFrame *out, AVFrame *in) if (ret < 0) return ret; + if (out->width != in->width || out->height != in->height) + av_frame_remove_side_data_changed(out, AV_FRAME_CHANGED_SIZE); + return 0; } diff --git a/libavfilter/vf_scale_npp.c b/libavfilter/vf_scale_npp.c index 27e5e584ae..ed09f4f301 100644 --- a/libavfilter/vf_scale_npp.c +++ b/libavfilter/vf_scale_npp.c @@ -892,6 +892,9 @@ scale: if (ret < 0) return ret; + if (out->width != in->width || out->height != in->height) + av_frame_remove_side_data_changed(out, AV_FRAME_CHANGED_SIZE); + return 0; } diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c index 5f20b8a43c..cf7af5c68e 100644 --- a/libavfilter/vf_scale_vaapi.c +++ b/libavfilter/vf_scale_vaapi.c @@ -137,6 +137,9 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) if (err < 0) goto fail; + if (output_frame->width != input_frame->width || output_frame->height != input_frame->height) + av_frame_remove_side_data_changed(output_frame, AV_FRAME_CHANGED_SIZE); + if (ctx->colour_primaries != AVCOL_PRI_UNSPECIFIED) output_frame->color_primaries = ctx->colour_primaries; if (ctx->colour_transfer != AVCOL_TRC_UNSPECIFIED) diff --git a/libavfilter/vf_scale_vt.c b/libavfilter/vf_scale_vt.c index af4a8b32c6..085f14d5fe 100644 --- a/libavfilter/vf_scale_vt.c +++ b/libavfilter/vf_scale_vt.c @@ -141,6 +141,9 @@ static int scale_vt_filter_frame(AVFilterLink *link, AVFrame *in) if (ret < 0) goto fail; + if (out->width != in->width || out->height != in->height) + av_frame_remove_side_data_changed(out, AV_FRAME_CHANGED_SIZE); + av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den, (int64_t)in->sample_aspect_ratio.num * outlink->h * link->w, (int64_t)in->sample_aspect_ratio.den * outlink->w * link->h, diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c index 7210509de3..957f99a4d5 100644 --- a/libavfilter/vf_scale_vulkan.c +++ b/libavfilter/vf_scale_vulkan.c @@ -288,6 +288,9 @@ static int scale_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) if (err < 0) goto fail; + if (out->width != in->width || out->height != in->height) + av_frame_remove_side_data_changed(out, AV_FRAME_CHANGED_SIZE); + if (s->out_range != AVCOL_RANGE_UNSPECIFIED) out->color_range = s->out_range; if (s->vkctx.output_format != s->vkctx.input_format) -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".