1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +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:
Ganesh Ajjanagadde 2015-09-01 08:10:04 -07:00 committed by Paul B Mahol
parent 9136e65c40
commit c0ae4619ec

View File

@ -107,24 +107,24 @@ AVFILTER_DEFINE_CLASS(sab);
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 */
if (sab->chroma.radius < RADIUS_MIN)
sab->chroma.radius = sab->luma.radius;
if (sab->chroma.pre_filter_radius < PRE_FILTER_RADIUS_MIN)
sab->chroma.pre_filter_radius = sab->luma.pre_filter_radius;
if (sab->chroma.strength < STRENGTH_MIN)
sab->chroma.strength = sab->luma.strength;
if (s->chroma.radius < RADIUS_MIN)
s->chroma.radius = s->luma.radius;
if (s->chroma.pre_filter_radius < PRE_FILTER_RADIUS_MIN)
s->chroma.pre_filter_radius = s->luma.pre_filter_radius;
if (s->chroma.strength < STRENGTH_MIN)
s->chroma.strength = s->luma.strength;
sab->luma.quality = sab->chroma.quality = 3.0;
sab->sws_flags = SWS_POINT;
s->luma.quality = s->chroma.quality = 3.0;
s->sws_flags = SWS_POINT;
av_log(ctx, AV_LOG_VERBOSE,
"luma_radius:%f luma_pre_filter_radius::%f luma_strength:%f "
"chroma_radius:%f chroma_pre_filter_radius:%f chroma_strength:%f\n",
sab->luma .radius, sab->luma .pre_filter_radius, sab->luma .strength,
sab->chroma.radius, sab->chroma.pre_filter_radius, sab->chroma.strength);
s->luma .radius, s->luma .pre_filter_radius, s->luma .strength,
s->chroma.radius, s->chroma.pre_filter_radius, s->chroma.strength);
return 0;
}
@ -140,10 +140,10 @@ static void close_filter_param(FilterParam *f)
static av_cold void uninit(AVFilterContext *ctx)
{
SabContext *sab = ctx->priv;
SabContext *s = ctx->priv;
close_filter_param(&sab->luma);
close_filter_param(&sab->chroma);
close_filter_param(&s->luma);
close_filter_param(&s->chroma);
}
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)
{
SabContext *sab = inlink->dst->priv;
SabContext *s = inlink->dst->priv;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
int ret;
sab->hsub = desc->log2_chroma_w;
sab->vsub = desc->log2_chroma_h;
s->hsub = desc->log2_chroma_w;
s->vsub = desc->log2_chroma_h;
close_filter_param(&sab->luma);
ret = open_filter_param(&sab->luma, inlink->w, inlink->h, sab->sws_flags);
close_filter_param(&s->luma);
ret = open_filter_param(&s->luma, inlink->w, inlink->h, s->sws_flags);
if (ret < 0)
return ret;
close_filter_param(&sab->chroma);
ret = open_filter_param(&sab->chroma,
FF_CEIL_RSHIFT(inlink->w, sab->hsub),
FF_CEIL_RSHIFT(inlink->h, sab->vsub), sab->sws_flags);
close_filter_param(&s->chroma);
ret = open_filter_param(&s->chroma,
FF_CEIL_RSHIFT(inlink->w, s->hsub),
FF_CEIL_RSHIFT(inlink->h, s->vsub), s->sws_flags);
return ret;
}
@ -281,7 +281,7 @@ static void blur(uint8_t *dst, const int dst_linesize,
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
{
SabContext *sab = inlink->dst->priv;
SabContext *s = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *outpic;
@ -293,12 +293,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
av_frame_copy_props(outpic, inpic);
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]) {
int cw = FF_CEIL_RSHIFT(inlink->w, sab->hsub);
int ch = FF_CEIL_RSHIFT(inlink->h, sab->vsub);
blur(outpic->data[1], outpic->linesize[1], inpic->data[1], inpic->linesize[1], cw, ch, &sab->chroma);
blur(outpic->data[2], outpic->linesize[2], inpic->data[2], inpic->linesize[2], cw, ch, &sab->chroma);
int cw = FF_CEIL_RSHIFT(inlink->w, s->hsub);
int ch = FF_CEIL_RSHIFT(inlink->h, s->vsub);
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, &s->chroma);
}
av_frame_free(&inpic);