On Wed, May 18, 2011 at 5:49 PM, Stefano Sabatini < [email protected]> wrote:
> 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.). > > ok, I will try do it. > > > > + 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. > Ah, my bad. At first the ">> 2" is "/ 2", but after I use patcheck it suggest to use ">>", so I change it but left the "2". Sorry for the noise. > > Also please add some docs in doc/filters.texi. > OK, I'll try add some text there. > _______________________________________________ > libav-devel mailing list > [email protected] > https://lists.libav.org/mailman/listinfo/libav-devel > -- wucan
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
