On date Tuesday 2011-05-17 21:36:17 +0800, Can Wu encoded:
> On Tue, May 17, 2011 at 6:18 PM, Stefano Sabatini <
> [email protected]> wrote:
>
> > On date Tuesday 2011-05-17 12:05:34 +0800, Can Wu encoded:
[...]
> > This code can be factorized by using a common routine, maybe the code
> > could be shared with blackframe (and put it in the same file and save
> > some RAM).
> >
> add a common route for this task is not easy really.
> yes, It had codes interleaved with blackframe, but a dedicated filter is
> better I think.
I'm not saying to extend blackframe, but to write the blackmargin in
the same file, and share code when possible (init, query_formats,
etc.).
> > > + for (y = 0; y < (inlink->h >> 2); y++) {
> > > + p += picref->linesize[0];
> > > + nblack = 0;
> > > + for (x = 0; x < inlink->w; x++) {
> > > + nblack += p[x] < blackmargin->bthresh;
> > > + }
> > > + pblack = nblack * 100 / inlink->w;
> > > + if (pblack < blackmargin->bamount) {
> > > + break;
> > > + }
> > > + }
> > > + margin_top = y;
> > > +
> > > + /* down */
> > > + p = picref->data[0] + picref->linesize[0] * inlink->h;
> > > + for (y = inlink->h; y > (inlink->h >> 2); y--) {
> > > + p -= picref->linesize[0];
> > > + nblack = 0;
> > > + for (x = 0; x < inlink->w; x++) {
> > > + nblack += p[x] < blackmargin->bthresh;
> > > + }
> > > + pblack = nblack * 100 / inlink->w;
> > > + if (pblack < blackmargin->bamount) {
> > > + break;
> > > + }
> > > + }
What's the issue with factorizing this code?
BTW add a note briefly explaining the meaning of >>2, it's not obvious
at the first reading.
Also please add some docs in doc/filters.texi.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel