[FFmpeg-devel] [PATCH] add phqm filter and img_hash

Carl Eugen Hoyos ceffmpeg at gmail.com
Fri Oct 25 12:25:07 EEST 2019


Am Fr., 25. Okt. 2019 um 02:24 Uhr schrieb <ckennedy at ellation.com>:

> +// convert from avframe to iplimage format
> +static void fill_iplimage_from_frame(IplImage *img, const AVFrame *frame, enum AVPixelFormat pixfmt)
> +{
> +    IplImage *tmpimg;
> +    int depth, channels_nb;
> +
> +    if      (pixfmt == AV_PIX_FMT_GRAY8) { depth = IPL_DEPTH_8U;  channels_nb = 1; }
> +    else if (pixfmt == AV_PIX_FMT_BGRA)  { depth = IPL_DEPTH_8U;  channels_nb = 4; }
> +    else if (pixfmt == AV_PIX_FMT_BGR24) { depth = IPL_DEPTH_8U;  channels_nb = 3; }
> +    else if (pixfmt == AV_PIX_FMT_YUV420P) { depth = IPL_DEPTH_8U;  channels_nb = 3; }
> +    else return;
> +
> +    tmpimg = cvCreateImageHeader((CvSize){frame->width, frame->height}, depth, channels_nb);
> +    *img = *tmpimg;
> +    img->imageData = img->imageDataOrigin = (char *) frame->data[0];

How did you test YUV420P?

Carl Eugen


More information about the ffmpeg-devel mailing list