[MPlayer-dev-eng] [PATCH] video filter 2d denoiser

D Richard Felker III dalias at aerifal.cx
Wed Sep 10 16:54:55 CEST 2003


On Wed, Sep 10, 2003 at 06:14:02PM +0400, "?????? ??????"  wrote:
> Hi all!
>                                                                                               
> I wrote very nice 2d video denoiser filter, but there`s one question with it.
>                                                                                               
> In this filter I change only first colorplane (Y), so I want to
> pass U and V componets without any changes.
> If I write something like
>                                                                                               
> dmpi->planes[1] = mpi->planes[1];
> dmpi->planes[2] = mpi->planes[2];

This is allowed ONLY if you're using an EXPORT type image! Otherwise
it will trash internal structures and possibly crash or do other bad
things! IMO you should create an export type image, allocate your own
buffer for Y, and then do the above for U and V planes.

> memcpy (dmpi->planes[1], mpi->planes[1], mpi->h * mpi->stride[1] / 2);
> memcpy (dmpi->planes[2], mpi->planes[2], mpi->h * mpi->stride[2] / 2);
>                                                                                               
> and assept only "IMGFMT_YV12" format. But this looks VERY ugly.
> How can I do it correctly?

This is also incorrect; it will write outside of the image boundaries
if stride > width. Instead you should use memcpy_pic with the
chroma_width, chroma_height, and stride from mpi. Or better, use the
EXPORT approach.

Rich



More information about the MPlayer-dev-eng mailing list