From patchwork Tue Mar 19 14:57:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ulf Zibis X-Patchwork-Id: 12354 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 4131D44736C for ; Tue, 19 Mar 2019 16:58:08 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0E9EF68A7D8; Tue, 19 Mar 2019 16:58:08 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from wp215.webpack.hosteurope.de (wp215.webpack.hosteurope.de [80.237.132.222]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7C409680A28 for ; Tue, 19 Mar 2019 16:58:01 +0200 (EET) Received: from dslb-092-073-091-235.092.073.pools.vodafone-ip.de ([92.73.91.235] helo=[192.168.178.140]); authenticated by wp215.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1h6GBj-00019A-DF; Tue, 19 Mar 2019 15:58:00 +0100 To: ffmpeg-devel@ffmpeg.org References: <20190311232534.GG31978@sunshine.barsnick.net> From: Ulf Zibis Message-ID: Date: Tue, 19 Mar 2019 15:57:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-bounce-key: webpack.hosteurope.de; ulf.zibis@cosoco.de; 1553007486; 27ab66c8; X-HE-SMSGID: 1h6GBj-00019A-DF Subject: Re: [FFmpeg-devel] =?utf-8?q?=5BPatch=5D_beautified_+_accelerated_vf?= =?utf-8?q?=5Ffillborders_=E2=80=93_Please_review?= X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi again, Am 12.03.19 um 00:37 schrieb Carl Eugen Hoyos: > 2019-03-12 0:25 GMT+01:00, Moritz Barsnick : >> Ideally, you use the START_TIMER/STOP_TIMER macros to >> profile the actual functions you changed. (Check this mailing list's >> archives for some examples, and play with the code.) > But this should not be needed if time (the command) and / or > benchmark (the FFmpeg option) show clear improvements. With the benchmark option I can not see the time for the filter, just for the de/encoding, and as I assume, that this filter is much faster than the de/encoding around it, I suspect, the overall time will be helpful. So I have "played" with the START_TIMER/STOP_TIMER macros. Now I'm kind of helpless, as the numbers I get are varying in wide range. It seems, that my changes help a little for e.g. "-vf fillborders:0:0:5:5:mirror". This is what I expected by bypassing the code loops for the right/left borders, when there is nothing to do, but the timer results are "noisy". I attach the patches for the first 2 chunks again, and too the patches for my timed version. Hopefully you have the time to play a little with that and can give me hints, how I could get more reliable numbers. (I just had closed all other applications like Firefox, Transmission etc. before running the benchmarks) -Ulf ========================================================================== $ debug/fillborders.sh Test[0] ======> 3-plane 8-bit YUV-colour:    CYD_1005.jpg <====== ./ffmpeg-p1 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-0-0-5-5.jpg  122670 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  133020 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  119430 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  118350 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  124740 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  122130 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips ./ffmpeg-p2 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-0-0-5-5.jpg  118800 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  123840 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  121500 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  135090 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  126270 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  125730 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips ./ffmpeg-p1 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-5-5-0-0.jpg  557730 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  614880 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  598410 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  545940 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  591030 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  566910 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips ./ffmpeg-p2 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-5-5-0-0.jpg  542430 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  567900 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  490050 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  579330 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  521370 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  890370 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips ./ffmpeg-p1 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-5-5-5-5.jpg  576540 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  597060 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  599940 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  621900 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  588870 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  606600 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips ./ffmpeg-p2 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-5-5-5-5.jpg  522090 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  655650 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  609660 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  600300 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  561510 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  630090 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips ===================================================================================== $ debug/fillborders.sh Test[0] ======> 3-plane 8-bit YUV-colour:    CYD_1005.jpg <====== ./ffmpeg-p1 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-0-0-5-5.jpg  131220 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  141030 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  135900 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  133380 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  148230 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  119880 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips ./ffmpeg-p2 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-0-0-5-5.jpg  165870 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  120960 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  126450 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  122310 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  132660 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  122940 decicycles in fillborders=0:0:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips ./ffmpeg-p1 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-5-5-0-0.jpg  578160 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  571140 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  652320 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  571500 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  756810 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  515880 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips ./ffmpeg-p2 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-5-5-0-0.jpg  625140 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  595260 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  552600 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  636390 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  687960 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips  648900 decicycles in fillborders=5:5:0:0:mirror 3p-8bit-1x1,       1 runs,      0 skips ./ffmpeg-p1 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-5-5-5-5.jpg  578610 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  552060 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  604980 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  486900 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  498780 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  549900 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips ./ffmpeg-p2 : CYD_1005.jpg --> ZZ_CYD_1005_mirror-5-5-5-5.jpg  642240 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  658710 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips 1701630 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  676350 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  622350 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips  693630 decicycles in fillborders=5:5:5:5:mirror 3p-8bit-1x1,       1 runs,      0 skips ============================================================================== From 8201c51ced164efdcee292f71cc94d0a7ab38b18 Mon Sep 17 00:00:00 2001 From: Ulf Zibis Date: 19.03.2019, 02:52:44 avfilter/fillborders: avoid needless calculations for performance; added ffmpeg-p2 and rgba64le-lzw.tif to benchmark diff --git a/debug/fillborders.sh b/debug/fillborders.sh index 671032b..1bd7e12 100755 --- a/debug/fillborders.sh +++ b/debug/fillborders.sh @@ -1,8 +1,9 @@ #!/bin/bash i=0 -test[i++]="3-plane 8-bit YUV-colour: CYD_1005.jpg" -test[i++]="4-plane 8-bit RGB-colour: 8.jpg" -test[i++]="4-plane 16-bit RGB-colour: 16.jpg" +test[i++]="3-plane 8-bit YUV-420: CYD_1005.jpg" +#test[i++]="1-plane 8-bit Y-400: 8.jpg" +#test[i++]="1-plane 16-bit Y-400: 16.jpg" +#test[i++]="4-plane 16-bit RGB-444: rgba64le-lzw.tif" for ((i=0;i<${#test[@]};i++)) do @@ -13,10 +14,10 @@ for borders in "0:0:5:5" "5:5:0:0" "5:5:5:5" do output="ZZ_${input%.*}_${mode%:*}-${borders//:/-}.${input##*.}" - for patch in "ffmpeg " "./ffmpeg-p1" + for patch in "./ffmpeg-p1" "./ffmpeg-p2" do - echo "${patch} ${input} --> ${output}" - for ((benchmark=0;benchmark<3;benchmark++)) + echo "${patch} : ${input} --> ${output}" + for ((benchmark=0;benchmark<6;benchmark++)) do ${patch} -y -v error -i debug/${input} -vf fillborders=${borders}:${mode} debug/${output} done diff --git a/libavfilter/vf_fillborders.c b/libavfilter/vf_fillborders.c index e06b8e8..15cf5d9 100644 --- a/libavfilter/vf_fillborders.c +++ b/libavfilter/vf_fillborders.c @@ -93,14 +93,16 @@ int linesize = frame->linesize[p]; /* fill left and right borders from top to bottom border */ - for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { - memset(data + y * linesize, - *(data + y * linesize + s->borders[p].left), - s->borders[p].left); - memset(data + y * linesize + s->planewidth[p] - s->borders[p].right, - *(data + y * linesize + s->planewidth[p] - s->borders[p].right - 1), - s->borders[p].right); - } + if (s->borders[p].left != 0 || + s->borders[p].right != s->planewidth[p]) // in case skip for performance + for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { + memset(data + y * linesize, + *(data + y * linesize + s->borders[p].left), + s->borders[p].left); + memset(data + y * linesize + s->planewidth[p] - s->borders[p].right, + *(data + y * linesize + s->planewidth[p] - s->borders[p].right - 1), + s->borders[p].right); + } /* fill top and bottom borders */ for (y = 0; y < s->borders[p].top; y++) { @@ -124,15 +126,17 @@ int linesize = frame->linesize[p] / sizeof(uint16_t); /* fill left and right borders from top to bottom border */ - for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { - for (x = 0; x < s->borders[p].left; x++) { - data[y * linesize + x] = *(data + y * linesize + s->borders[p].left); + if (s->borders[p].left != 0 || + s->borders[p].right != s->planewidth[p]) // in case skip for performance + for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { + for (x = 0; x < s->borders[p].left; x++) { + data[y * linesize + x] = *(data + y * linesize + s->borders[p].left); + } + for (x = 0; x < s->borders[p].right; x++) { + data[y * linesize + s->planewidth[p] - s->borders[p].right + x] = + *(data + y * linesize + s->planewidth[p] - s->borders[p].right - 1); + } } - for (x = 0; x < s->borders[p].right; x++) { - data[y * linesize + s->planewidth[p] - s->borders[p].right + x] = - *(data + y * linesize + s->planewidth[p] - s->borders[p].right - 1); - } - } /* fill top and bottom borders */ for (y = 0; y < s->borders[p].top; y++) { @@ -156,15 +160,17 @@ int linesize = frame->linesize[p]; /* fill left and right borders from top to bottom border */ - for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { - for (x = 0; x < s->borders[p].left; x++) { - data[y * linesize + x] = data[y * linesize + s->borders[p].left * 2 - 1 - x]; + if (s->borders[p].left != 0 || + s->borders[p].right != s->planewidth[p]) // in case skip for performance + for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { + for (x = 0; x < s->borders[p].left; x++) { + data[y * linesize + x] = data[y * linesize + s->borders[p].left * 2 - 1 - x]; + } + for (x = 0; x < s->borders[p].right; x++) { + data[y * linesize + s->planewidth[p] - s->borders[p].right + x] = + data[y * linesize + s->planewidth[p] - s->borders[p].right - 1 - x]; + } } - for (x = 0; x < s->borders[p].right; x++) { - data[y * linesize + s->planewidth[p] - s->borders[p].right + x] = - data[y * linesize + s->planewidth[p] - s->borders[p].right - 1 - x]; - } - } /* fill top and bottom borders */ for (y = 0; y < s->borders[p].top; y++) { @@ -189,16 +195,18 @@ int linesize = frame->linesize[p] / sizeof(uint16_t); /* fill left and right borders from top to bottom border */ - for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { - for (x = 0; x < s->borders[p].left; x++) { - data[y * linesize + x] = data[y * linesize + s->borders[p].left * 2 - 1 - x]; - } + if (s->borders[p].left != 0 || + s->borders[p].right != s->planewidth[p]) // in case skip for performance + for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { + for (x = 0; x < s->borders[p].left; x++) { + data[y * linesize + x] = data[y * linesize + s->borders[p].left * 2 - 1 - x]; + } - for (x = 0; x < s->borders[p].right; x++) { - data[y * linesize + s->planewidth[p] - s->borders[p].right + x] = - data[y * linesize + s->planewidth[p] - s->borders[p].right - 1 - x]; + for (x = 0; x < s->borders[p].right; x++) { + data[y * linesize + s->planewidth[p] - s->borders[p].right + x] = + data[y * linesize + s->planewidth[p] - s->borders[p].right - 1 - x]; + } } - } /* fill top and bottom borders */ for (y = 0; y < s->borders[p].top; y++) { @@ -224,11 +232,13 @@ int linesize = frame->linesize[p]; /* fill left and right borders from top to bottom border */ - for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { - memset(data + y * linesize, fill, s->borders[p].left); - memset(data + y * linesize + s->planewidth[p] - s->borders[p].right, fill, - s->borders[p].right); - } + if (s->borders[p].left != 0 || + s->borders[p].right != s->planewidth[p]) // in case skip for performance + for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { + memset(data + y * linesize, fill, s->borders[p].left); + memset(data + y * linesize + s->planewidth[p] - s->borders[p].right, fill, + s->borders[p].right); + } /* fill top and bottom borders */ for (y = 0; y < s->borders[p].top; y++) { @@ -250,14 +260,16 @@ int linesize = frame->linesize[p] / sizeof(uint16_t); /* fill left and right borders from top to bottom border */ - for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { - for (x = 0; x < s->borders[p].left; x++) { - data[y * linesize + x] = fill; + if (s->borders[p].left != 0 || + s->borders[p].right != s->planewidth[p]) // in case skip for performance + for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) { + for (x = 0; x < s->borders[p].left; x++) { + data[y * linesize + x] = fill; + } + for (x = 0; x < s->borders[p].right; x++) { + data[y * linesize + s->planewidth[p] - s->borders[p].right + x] = fill; + } } - for (x = 0; x < s->borders[p].right; x++) { - data[y * linesize + s->planewidth[p] - s->borders[p].right + x] = fill; - } - } /* fill top and bottom borders */ for (y = 0; y < s->borders[p].top; y++) { @@ -303,6 +315,20 @@ FillBordersContext *s = ctx->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); + if (inlink->w < s->left + s->right || + inlink->w <= s->left || + inlink->w <= s->right || + inlink->h < s->top + s->bottom || + inlink->h <= s->top || + inlink->h <= s->bottom || + inlink->w < s->left * 2 || + inlink->w < s->right * 2 || + inlink->h < s->top * 2 || + inlink->h < s->bottom * 2) { + av_log(ctx, AV_LOG_ERROR, "Borders are bigger than input frame size.\n"); + return AVERROR(EINVAL); + } + s->nb_planes = desc->nb_components; s->depth = desc->comp[0].depth; @@ -326,40 +352,23 @@ s->borders[2].top = s->top >> desc->log2_chroma_h; s->borders[2].bottom = s->bottom >> desc->log2_chroma_h; - if (inlink->w < s->left + s->right || - inlink->w <= s->left || - inlink->w <= s->right || - inlink->h < s->top + s->bottom || - inlink->h <= s->top || - inlink->h <= s->bottom || - inlink->w < s->left * 2 || - inlink->w < s->right * 2 || - inlink->h < s->top * 2 || - inlink->h < s->bottom * 2) { - av_log(ctx, AV_LOG_ERROR, "Borders are bigger than input frame size.\n"); - return AVERROR(EINVAL); - } - switch (s->mode) { case FM_SMEAR: s->fillborders = s->depth <= 8 ? smear_borders8 : smear_borders16; break; case FM_MIRROR: s->fillborders = s->depth <= 8 ? mirror_borders8 : mirror_borders16; break; - case FM_FIXED: s->fillborders = s->depth <= 8 ? fixed_borders8 : fixed_borders16; break; - } - - s->yuv_color[Y] = RGB_TO_Y_CCIR(s->rgba_color[R], s->rgba_color[G], s->rgba_color[B]); - s->yuv_color[U] = RGB_TO_U_CCIR(s->rgba_color[R], s->rgba_color[G], s->rgba_color[B], 0); - s->yuv_color[V] = RGB_TO_V_CCIR(s->rgba_color[R], s->rgba_color[G], s->rgba_color[B], 0); - s->yuv_color[A] = s->rgba_color[A]; - - if (desc->flags & AV_PIX_FMT_FLAG_RGB) { - uint8_t rgba_map[4]; - int i; - - ff_fill_rgba_map(rgba_map, inlink->format); - for (i = 0; i < sizeof(rgba_map); i++) - s->fill[rgba_map[i]] = s->rgba_color[i]; - } else { - memcpy(s->fill, s->yuv_color, sizeof(s->yuv_color)); + case FM_FIXED: s->fillborders = s->depth <= 8 ? fixed_borders8 : fixed_borders16; + if (desc->flags & AV_PIX_FMT_FLAG_RGB) { + uint8_t rgba_map[4]; + int i; + ff_fill_rgba_map(rgba_map, inlink->format); + for (i = 0; i < sizeof(rgba_map); i++) + s->fill[rgba_map[i]] = s->rgba_color[i]; + } else { + s->yuv_color[Y] = RGB_TO_Y_CCIR(s->rgba_color[R], s->rgba_color[G], s->rgba_color[B]); + s->yuv_color[U] = RGB_TO_U_CCIR(s->rgba_color[R], s->rgba_color[G], s->rgba_color[B], 0); + s->yuv_color[V] = RGB_TO_V_CCIR(s->rgba_color[R], s->rgba_color[G], s->rgba_color[B], 0); + s->yuv_color[A] = s->rgba_color[A]; + memcpy(s->fill, s->yuv_color, sizeof(s->yuv_color)); + } break; } return 0;