📄 i420_rgb.h
字号:
*p_pic++ = *p_buffer; p_buffer += *p_offset++; \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ } \ for( i_x = p_vout->output.i_width & 15; i_x--; ) \ { \ *p_pic++ = *p_buffer; p_buffer += *p_offset++; \ } \ p_pic = (void*)((uint8_t*)p_pic + i_right_margin ); \ } \ else \ { \ /* No scaling, conversion has been done directly in picture memory. \ * Increment of picture pointer to end of line is still needed */ \ p_pic = (void*)((uint8_t*)p_pic + p_dest->p->i_pitch ); \ } \/***************************************************************************** * SCALE_WIDTH_DITHER: scale a line horizontally for dithered 8 bpp ***************************************************************************** * This macro scales a line using an offset array. *****************************************************************************/#define SCALE_WIDTH_DITHER( CHROMA ) \ if( b_hscale ) \ { \ /* Horizontal scaling - we can't use a buffer due to dithering */ \ p_offset = p_offset_start; \ for( i_x = p_vout->output.i_width / 16; i_x--; ) \ { \ CONVERT_4YUV_PIXEL_SCALE( CHROMA ) \ CONVERT_4YUV_PIXEL_SCALE( CHROMA ) \ CONVERT_4YUV_PIXEL_SCALE( CHROMA ) \ CONVERT_4YUV_PIXEL_SCALE( CHROMA ) \ } \ } \ else \ { \ for( i_x = p_vout->render.i_width / 16; i_x--; ) \ { \ CONVERT_4YUV_PIXEL( CHROMA ) \ CONVERT_4YUV_PIXEL( CHROMA ) \ CONVERT_4YUV_PIXEL( CHROMA ) \ CONVERT_4YUV_PIXEL( CHROMA ) \ } \ } \ /* Increment of picture pointer to end of line is still needed */ \ p_pic = (void*)((uint8_t*)p_pic + i_right_margin ); \ \ /* Increment the Y coordinate in the matrix, modulo 4 */ \ i_real_y = (i_real_y + 1) & 0x3; \/***************************************************************************** * SCALE_HEIGHT: handle vertical scaling ***************************************************************************** * This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or * 444 for RGB conversion, or 400 for gray conversion. It works for 1, 2, 3 * and 4 Bpp. *****************************************************************************/#define SCALE_HEIGHT( CHROMA, BPP ) \ /* If line is odd, rewind 4:2:0 U and V samples */ \ if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) ) \ { \ p_u -= i_chroma_width; \ p_v -= i_chroma_width; \ } \ \ /* \ * Handle vertical scaling. The current line can be copied or next one \ * can be ignored. \ */ \ switch( i_vscale ) \ { \ case -1: /* vertical scaling factor is < 1 */ \ while( (i_scale_count -= p_vout->output.i_height) > 0 ) \ { \ /* Height reduction: skip next source line */ \ p_y += p_vout->render.i_width; \ i_y++; \ if( (CHROMA == 420) || (CHROMA == 422) ) \ { \ if( i_y & 0x1 ) \ { \ p_u += i_chroma_width; \ p_v += i_chroma_width; \ } \ } \ else if( CHROMA == 444 ) \ { \ p_u += p_vout->render.i_width; \ p_v += p_vout->render.i_width; \ } \ } \ i_scale_count += p_vout->render.i_height; \ break; \ case 1: /* vertical scaling factor is > 1 */ \ while( (i_scale_count -= p_vout->render.i_height) > 0 ) \ { \ /* Height increment: copy previous picture line */ \ p_vout->p_vlc->pf_memcpy( p_pic, p_pic_start, \ p_vout->output.i_width * BPP ); \ p_pic = (void*)((uint8_t*)p_pic + p_dest->p->i_pitch ); \ } \ i_scale_count += p_vout->output.i_height; \ break; \ } \/***************************************************************************** * SCALE_HEIGHT_DITHER: handle vertical scaling for dithered 8 bpp ***************************************************************************** * This macro handles vertical scaling for a picture. CHROMA may be 420, * 422 or 444 for RGB conversion, or 400 for gray conversion. *****************************************************************************/#define SCALE_HEIGHT_DITHER( CHROMA ) \ \ /* If line is odd, rewind 4:2:0 U and V samples */ \ if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) ) \ { \ p_u -= i_chroma_width; \ p_v -= i_chroma_width; \ } \ \ /* \ * Handle vertical scaling. The current line can be copied or next one \ * can be ignored. \ */ \ \ switch( i_vscale ) \ { \ case -1: /* vertical scaling factor is < 1 */ \ while( (i_scale_count -= p_vout->output.i_height) > 0 ) \ { \ /* Height reduction: skip next source line */ \ p_y += p_vout->render.i_width; \ i_y++; \ if( (CHROMA == 420) || (CHROMA == 422) ) \ { \ if( i_y & 0x1 ) \ { \ p_u += i_chroma_width; \ p_v += i_chroma_width; \ } \ } \ else if( CHROMA == 444 ) \ { \ p_u += p_vout->render.i_width; \ p_v += p_vout->render.i_width; \ } \ } \ i_scale_count += p_vout->render.i_height; \ break; \ case 1: /* vertical scaling factor is > 1 */ \ while( (i_scale_count -= p_vout->render.i_height) > 0 ) \ { \ p_y -= p_vout->render.i_width; \ p_u -= i_chroma_width; \ p_v -= i_chroma_width; \ SCALE_WIDTH_DITHER( CHROMA ); \ } \ i_scale_count += p_vout->output.i_height; \ break; \ } \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -