[FFmpeg-devel] [PATCH] avfilter/vf_xcam: add xcam video filter

zhilizhao quinkblack at foxmail.com
Fri Jul 31 05:51:20 EEST 2020



> On Jul 31, 2020, at 3:08 AM, Alexander Strasser <eclipse7 at gmx.net> wrote:
> 
> Hi!
> 
> On 2020-07-30 12:16 +0000, Zane van Iperen wrote:
>> On Fri, 31 Jul 2020 00:55:56 +0800
>> "zongwave" <wei.zong at intel.com> wrote:
> [...]
>> 
>>> ++static av_cold int xcam_init(AVFilterContext *ctx)
>>> ++{
>>> ++    XCAMContext *s = ctx->priv;
>>> ++    int ret = 0;
>>> ++
>>> ++    s->handle = xcam_create_handle(s->name);
>>> ++    if (!s->handle) {
>> 
>> Style nitpick, I'd tend to prefer inlining the assignment:
>> 
>>    if (!(s->handle = xcam_create_handle(s->name)))
>> 
>> but I guess that's personal preference.
> 
> Please don't. There were many bugs because of stuffing the
> assignment into the condition. It's not so likely to be
> spotted once it's planted inside. IMHO the trade off for
> most cases, saving one line, is not worth it.

+1

If there is no logical not operator, it’s looks cumbersome like this

    if ((s->handle = xcam_create_handle(s->name)))

And drop brackets will trigger compiler warning.

> 
> 
>> Overall looks fine, but someone more familiar with
>> libavfilter should probably double-check.
> 
> 
>  Alexander
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list