I have a decoded AVFrame which I want to copy using memcpy to user allocated
memory. However, if I don't use swscale it becomes weird, even though both
dest and src pixel formats and sizes are the same.
What is sws_scale doing that I am not aware of?
e.g.
double param;
if(!sws_context_)
sws_context_.reset(sws_getContext(width, height, PIX_FMT_BGRA, width,
height, PIX_FMT_BGRA, SWS_BILINEAR, nullptr, nullptr, ¶m),
sws_freeContext);
#ifdef FRAME_DIRECT_COPY
memcpy(frame->data(), decoded_frame->data[0], width*height*4); // This
should be the same as below? but it's not.
#else
// This works just fine
AVFrame av_frame;
avcodec_get_frame_defaults(&av_frame);
avpicture_fill(reinterpret_cast<AVPicture*>(&av_frame), frame->data(),
PIX_FMT_BGRA, width, height);
sws_scale(sws_context_.get(), decoded_frame->data, decoded_frame->linesize,
0, height, av_frame.data, av_frame.linesize);
#endif
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user