mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
avfilter/vf_sab: use the name 's' for the pointer to the private context
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
This commit is contained in:
parent
9136e65c40
commit
c0ae4619ec
@ -107,24 +107,24 @@ AVFILTER_DEFINE_CLASS(sab);
|
|||||||
|
|
||||||
static av_cold int init(AVFilterContext *ctx)
|
static av_cold int init(AVFilterContext *ctx)
|
||||||
{
|
{
|
||||||
SabContext *sab = ctx->priv;
|
SabContext *s = ctx->priv;
|
||||||
|
|
||||||
/* make chroma default to luma values, if not explicitly set */
|
/* make chroma default to luma values, if not explicitly set */
|
||||||
if (sab->chroma.radius < RADIUS_MIN)
|
if (s->chroma.radius < RADIUS_MIN)
|
||||||
sab->chroma.radius = sab->luma.radius;
|
s->chroma.radius = s->luma.radius;
|
||||||
if (sab->chroma.pre_filter_radius < PRE_FILTER_RADIUS_MIN)
|
if (s->chroma.pre_filter_radius < PRE_FILTER_RADIUS_MIN)
|
||||||
sab->chroma.pre_filter_radius = sab->luma.pre_filter_radius;
|
s->chroma.pre_filter_radius = s->luma.pre_filter_radius;
|
||||||
if (sab->chroma.strength < STRENGTH_MIN)
|
if (s->chroma.strength < STRENGTH_MIN)
|
||||||
sab->chroma.strength = sab->luma.strength;
|
s->chroma.strength = s->luma.strength;
|
||||||
|
|
||||||
sab->luma.quality = sab->chroma.quality = 3.0;
|
s->luma.quality = s->chroma.quality = 3.0;
|
||||||
sab->sws_flags = SWS_POINT;
|
s->sws_flags = SWS_POINT;
|
||||||
|
|
||||||
av_log(ctx, AV_LOG_VERBOSE,
|
av_log(ctx, AV_LOG_VERBOSE,
|
||||||
"luma_radius:%f luma_pre_filter_radius::%f luma_strength:%f "
|
"luma_radius:%f luma_pre_filter_radius::%f luma_strength:%f "
|
||||||
"chroma_radius:%f chroma_pre_filter_radius:%f chroma_strength:%f\n",
|
"chroma_radius:%f chroma_pre_filter_radius:%f chroma_strength:%f\n",
|
||||||
sab->luma .radius, sab->luma .pre_filter_radius, sab->luma .strength,
|
s->luma .radius, s->luma .pre_filter_radius, s->luma .strength,
|
||||||
sab->chroma.radius, sab->chroma.pre_filter_radius, sab->chroma.strength);
|
s->chroma.radius, s->chroma.pre_filter_radius, s->chroma.strength);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,10 +140,10 @@ static void close_filter_param(FilterParam *f)
|
|||||||
|
|
||||||
static av_cold void uninit(AVFilterContext *ctx)
|
static av_cold void uninit(AVFilterContext *ctx)
|
||||||
{
|
{
|
||||||
SabContext *sab = ctx->priv;
|
SabContext *s = ctx->priv;
|
||||||
|
|
||||||
close_filter_param(&sab->luma);
|
close_filter_param(&s->luma);
|
||||||
close_filter_param(&sab->chroma);
|
close_filter_param(&s->chroma);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int open_filter_param(FilterParam *f, int width, int height, unsigned int sws_flags)
|
static int open_filter_param(FilterParam *f, int width, int height, unsigned int sws_flags)
|
||||||
@ -200,22 +200,22 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
|
|||||||
|
|
||||||
static int config_props(AVFilterLink *inlink)
|
static int config_props(AVFilterLink *inlink)
|
||||||
{
|
{
|
||||||
SabContext *sab = inlink->dst->priv;
|
SabContext *s = inlink->dst->priv;
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
sab->hsub = desc->log2_chroma_w;
|
s->hsub = desc->log2_chroma_w;
|
||||||
sab->vsub = desc->log2_chroma_h;
|
s->vsub = desc->log2_chroma_h;
|
||||||
|
|
||||||
close_filter_param(&sab->luma);
|
close_filter_param(&s->luma);
|
||||||
ret = open_filter_param(&sab->luma, inlink->w, inlink->h, sab->sws_flags);
|
ret = open_filter_param(&s->luma, inlink->w, inlink->h, s->sws_flags);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
close_filter_param(&sab->chroma);
|
close_filter_param(&s->chroma);
|
||||||
ret = open_filter_param(&sab->chroma,
|
ret = open_filter_param(&s->chroma,
|
||||||
FF_CEIL_RSHIFT(inlink->w, sab->hsub),
|
FF_CEIL_RSHIFT(inlink->w, s->hsub),
|
||||||
FF_CEIL_RSHIFT(inlink->h, sab->vsub), sab->sws_flags);
|
FF_CEIL_RSHIFT(inlink->h, s->vsub), s->sws_flags);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ static void blur(uint8_t *dst, const int dst_linesize,
|
|||||||
|
|
||||||
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
|
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
|
||||||
{
|
{
|
||||||
SabContext *sab = inlink->dst->priv;
|
SabContext *s = inlink->dst->priv;
|
||||||
AVFilterLink *outlink = inlink->dst->outputs[0];
|
AVFilterLink *outlink = inlink->dst->outputs[0];
|
||||||
AVFrame *outpic;
|
AVFrame *outpic;
|
||||||
|
|
||||||
@ -293,12 +293,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
|
|||||||
av_frame_copy_props(outpic, inpic);
|
av_frame_copy_props(outpic, inpic);
|
||||||
|
|
||||||
blur(outpic->data[0], outpic->linesize[0], inpic->data[0], inpic->linesize[0],
|
blur(outpic->data[0], outpic->linesize[0], inpic->data[0], inpic->linesize[0],
|
||||||
inlink->w, inlink->h, &sab->luma);
|
inlink->w, inlink->h, &s->luma);
|
||||||
if (inpic->data[2]) {
|
if (inpic->data[2]) {
|
||||||
int cw = FF_CEIL_RSHIFT(inlink->w, sab->hsub);
|
int cw = FF_CEIL_RSHIFT(inlink->w, s->hsub);
|
||||||
int ch = FF_CEIL_RSHIFT(inlink->h, sab->vsub);
|
int ch = FF_CEIL_RSHIFT(inlink->h, s->vsub);
|
||||||
blur(outpic->data[1], outpic->linesize[1], inpic->data[1], inpic->linesize[1], cw, ch, &sab->chroma);
|
blur(outpic->data[1], outpic->linesize[1], inpic->data[1], inpic->linesize[1], cw, ch, &s->chroma);
|
||||||
blur(outpic->data[2], outpic->linesize[2], inpic->data[2], inpic->linesize[2], cw, ch, &sab->chroma);
|
blur(outpic->data[2], outpic->linesize[2], inpic->data[2], inpic->linesize[2], cw, ch, &s->chroma);
|
||||||
}
|
}
|
||||||
|
|
||||||
av_frame_free(&inpic);
|
av_frame_free(&inpic);
|
||||||
|
Loading…
Reference in New Issue
Block a user