- // try bc_xfer methods
- int imodel = pix_fmt_to_color_model(ifmt);
- // if not compatible with xfer
- switch( imodel ) {
- case BC_YUV420P:
- case BC_YUV420PI:
- case BC_YUV422P:
- if( ip->linesize[0] != ip->linesize[1]*2 ||
- ip->linesize[0] != ip->linesize[2]*2 )
- imodel = -1;
- break;
- case BC_YUV410P:
- case BC_YUV411P:
- if( ip->linesize[0] != ip->linesize[1]*4 ||
- ip->linesize[0] != ip->linesize[2]*4 )
- imodel = -1;
- break;
- case BC_YUV444P:
- if( ip->linesize[0] != ip->linesize[1] ||
- ip->linesize[0] != ip->linesize[2] )
- imodel = -1;
- break;
- }
- if( imodel >= 0 ) {
- long y_ofs = 0, u_ofs = 0, v_ofs = 0;
- uint8_t *data = ip->data[0];
- if( BC_CModels::is_yuv(imodel) ) {
- u_ofs = ip->data[1] - data;
- v_ofs = ip->data[2] - data;
- }
- VFrame iframe(data, -1, y_ofs, u_ofs, v_ofs, iw, ih, imodel, ip->linesize[0]);
- frame->transfer_from(&iframe);
- return 0;
- }
- // try sws methods
- AVFrame opic;