int VFrame::clear_frame() { switch(color_model) { case BC_COMPRESSED: break; case BC_YUV888: ZERO_YUV(3, unsigned char, 0xff); break; case BC_YUVA8888: ZERO_YUV(4, unsigned char, 0xff); break; case BC_YUV161616: ZERO_YUV(3, uint16_t, 0xffff); break; case BC_YUVA16161616: ZERO_YUV(4, uint16_t, 0xffff); break; default: memset(data, 0, calculate_data_size(w, h, bytes_per_line, color_model)); break; } return 0; }
int VFrame::clear_frame() { int sz = w * h; //printf("VFrame::clear_frame %d\n", __LINE__); switch(color_model) { case BC_COMPRESSED: break; case BC_YUV410P: bzero(get_y(), sz); bzero(get_u(), w / 4 * h / 4); bzero(get_v(), w / 4 * h / 4); break; case BC_YUV411P: case BC_YUV420P: bzero(get_y(), sz); bzero(get_u(), sz / 4); bzero(get_v(), sz / 4); break; case BC_YUV422P: bzero(get_y(), sz); bzero(get_u(), sz / 2); bzero(get_v(), sz / 2); break; case BC_RGBA_FLOATP: if( a ) { float *ap = (float *)a; for( int i=sz; --i>=0; ++ap ) *ap = 1.f; } case BC_RGB_FLOATP: { float *rp = (float *)y; for( int i=sz; --i>=0; ++rp ) *rp = 0.f; float *gp = (float *)u; for( int i=sz; --i>=0; ++gp ) *gp = 0.f; float *bp = (float *)v; for( int i=sz; --i>=0; ++bp ) *bp = 0.f; break; } case BC_YUV444P: bzero(get_y(), sz); bzero(get_u(), sz); bzero(get_v(), sz); break; case BC_YUV888: ZERO_YUV(3, unsigned char, 0xff); break; case BC_YUVA8888: ZERO_YUV(4, unsigned char, 0xff); break; case BC_YUV161616: ZERO_YUV(3, uint16_t, 0xffff); break; case BC_YUVA16161616: ZERO_YUV(4, uint16_t, 0xffff); break; default: bzero(data, calculate_data_size(w, h, bytes_per_line, color_model)); break; } return 0; }