Am Fr., 25. Okt. 2019 um 02:24 Uhr schrieb <ckenn...@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
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to