Reputation: 121
I used hardware decoding on an Intel processor using QuickSync based on this example. https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/qsv_decode.c
Then I use sws_scale to color convert from NV12 to YUV420. But is there a way to use hardware acceleration for this too?
some part of my code
//decoding frame
int32_t ret = avcodec_receive_frame(_context, _tmpFrame); //i got _tmpFrame->format == AV_PIX_FMT_QSV
//retrieve data from GPU to CPU
av_hwframe_transfer_data(_decFrame, _tmpFrame, 0); //i got _decFrame->format == AV_PIX_FMT_NV12
//...some code next
//init context
conversion = sws_getContext(_context->width, _context->height, AV_PIX_FMT_NV12,
_context->width,_context->height, AV_PIX_FMT_YUV420P,
SWS_FAST_BILINEAR, NULL,NULL,NULL);
//convert frame (is Intel QuickSync used here)?
int32_t out_height = sws_scale(conversion, src_data, src_stride, 0, src_height, dst_data, dst_stride);
Upvotes: 1
Views: 593