[FFmpeg-devel] [PATCH] add top video filter
Mark Himsley
mark at mdsh.com
Wed Mar 30 01:09:08 CEST 2011
On 29/03/11 22:53, Stefano Sabatini wrote:
> On date Tuesday 2011-03-29 22:02:53 +0100, Mark Himsley encoded:
>> On 29/03/11 17:50, Stefano Sabatini wrote:
>>> On date Monday 2011-03-28 14:47:20 +0100, Mark Himsley encoded:
> [...]
>>>> + for (plane = 0; plane< 4&& outpic->data[plane]; plane++) {
>>>> + cpy_dst = outpic->data[plane] + y * outpic->linesize[plane];
>>>> + if (top->dst_tff) {
>>>> + for (i = 0; i< h; i++) {
>>>> + if (1 + y + i< outpic->video->h) {
>>>> + memcpy(cpy_dst, cpy_dst + outpic->linesize[plane], outpic->linesize[plane]);
>>>
>>> You're copying more than it is required, outpic->linesize[plane] -> line_step[plane] * w;
>>
>> Am I?
>> I want to copy a whole line, from line+1 to line.
>> Where does w some from BTW?
>
> Plane buffers are usually padded, so you may have:
> linesize[plane]> pixel_step*w
>
> Copying more than it is required is a waste of CPU, also you shouldn't
> write beyond the image region.
>
> w is the image width, that you can retrieve in inlink->w or in
> outpic->video->w.
>
> [...]
Thank you. Very clear.
I note that I also need to take into account
av_pix_fmt_descriptors[inlink->format].log2_chroma_w in the number of
bytes to memcopy.
I just need to test some more PIX_FMTs and I'll send another patch.
--
Mark
More information about the ffmpeg-devel
mailing list