- int colormodel = frame->get_color_model();
- int bits = BC_CModels::calculate_pixelsize(colormodel) * 8;
- bits /= BC_CModels::components(colormodel);
- int icolor_model = BC_CModels::has_alpha(colormodel) ?
- (bits > 8 ? BC_RGBA16161616 : BC_RGBA8888) :
- (bits > 8 ? BC_RGB161616: BC_RGB888) ;
- VFrame vframe(frame->get_w(), frame->get_h(), icolor_model);
+ int cmodel = frame->get_color_model();
+ int bits = BC_CModels::calculate_pixelsize(cmodel) * 8;
+ bits /= BC_CModels::components(cmodel);
+ AVPixelFormat ofmt = (AVPixelFormat)op->format;
+ int imodel = pix_fmt_to_color_model(ofmt);
+ if( imodel < 0 ) {
+ imodel =
+ BC_CModels::is_yuv(cmodel) ?
+ (BC_CModels::has_alpha(cmodel) ?
+ BC_AYUV16161616 :
+ (bits > 8 ? BC_AYUV16161616 : BC_YUV444P)) :
+ (BC_CModels::has_alpha(cmodel) ?
+ (bits > 8 ? BC_RGBA16161616 : BC_RGBA8888) :
+ (bits > 8 ? BC_RGB161616 : BC_RGB888)) ;
+ }
+ VFrame vframe(frame->get_w(), frame->get_h(), imodel);