📄 effects.c
字号:
( ( i_band_width * i + j ) /2 ) ) = 0x00; if( 0x04 * (i_line + k ) - 0x0f > 0 ) { if ( 0x04 * (i_line + k ) -0x0f < 0xff) *(p_picture->p[2].p_pixels + (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) * p_picture->p[2].i_pitch + ( ( i_band_width * i + j ) /2 ) ) = ( 0x04 * ( i_line + k ) ) -0x0f ; else *(p_picture->p[2].p_pixels + (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) * p_picture->p[2].i_pitch + ( ( i_band_width * i + j ) /2 ) ) = 0xff; } else { *(p_picture->p[2].p_pixels + (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) * p_picture->p[2].i_pitch + ( ( i_band_width * i + j ) /2 ) ) = 0x10 ; } } } } if(height[i] * i_amp > p_effect->i_height) height[i] = floor(p_effect->i_height / i_amp ); for(i_line = 0 ; i_line < i_amp * height[i]; i_line ++ ) { for( j = 0 ; j< i_band_width - i_separ ; j++) { *(p_picture->p[0].p_pixels + (p_picture->p[0].i_lines - i_line -1) * p_picture->p[0].i_pitch + (i_band_width*i +j) ) = 0xff; *(p_picture->p[1].p_pixels + (p_picture->p[1].i_lines - i_line /2 -1) * p_picture->p[1].i_pitch + ( ( i_band_width * i + j ) /2 ) ) = 0x00; if( 0x04 * i_line - 0x0f > 0 ) { if( 0x04 * i_line - 0x0f < 0xff ) *(p_picture->p[2].p_pixels + (p_picture->p[2].i_lines - i_line /2 - 1) * p_picture->p[2].i_pitch + ( ( i_band_width * i + j ) /2 ) ) = ( 0x04 * i_line) -0x0f ; else *(p_picture->p[2].p_pixels + (p_picture->p[2].i_lines - i_line /2 - 1) * p_picture->p[2].i_pitch + ( ( i_band_width * i + j ) /2 ) ) = 0xff; } else { *(p_picture->p[2].p_pixels + (p_picture->p[2].i_lines - i_line /2 - 1) * p_picture->p[2].i_pitch + ( ( i_band_width * i + j ) /2 ) ) = 0x10 ; } } } } fft_close( p_state ); if( p_s16_buff != NULL ) { free( p_s16_buff ); p_s16_buff = NULL; } if(height) free(height); if(psz_parse) free(psz_parse); return 0;}/***************************************************************************** * scope_Run: scope effect *****************************************************************************/int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, aout_buffer_t * p_buffer , picture_t * p_picture){ int i_index; float *p_sample ; uint8_t *ppp_area[2][3]; for( i_index = 0 ; i_index < 2 ; i_index++ ) { int j; for( j = 0 ; j < 3 ; j++ ) { ppp_area[i_index][j] = p_picture->p[j].p_pixels + i_index * p_picture->p[j].i_lines / 2 * p_picture->p[j].i_pitch; } } for( i_index = 0, p_sample = (float *)p_buffer->p_buffer; i_index < p_effect->i_width; i_index++ ) { uint8_t i_value; /* Left channel */ i_value = (*p_sample++ +1) * 127; *(ppp_area[0][0] + p_picture->p[0].i_pitch * i_index / p_effect->i_width + p_picture->p[0].i_lines * i_value / 512 * p_picture->p[0].i_pitch) = 0xbf; *(ppp_area[0][1] + p_picture->p[1].i_pitch * i_index / p_effect->i_width + p_picture->p[1].i_lines * i_value / 512 * p_picture->p[1].i_pitch) = 0xff; /* Right channel */ i_value = ( *p_sample++ +1 ) * 127; *(ppp_area[1][0] + p_picture->p[0].i_pitch * i_index / p_effect->i_width + p_picture->p[0].i_lines * i_value / 512 * p_picture->p[0].i_pitch) = 0x9f; *(ppp_area[1][2] + p_picture->p[2].i_pitch * i_index / p_effect->i_width + p_picture->p[2].i_lines * i_value / 512 * p_picture->p[2].i_pitch) = 0xdd; } return 0;}/***************************************************************************** * random_Run: random plots display effect *****************************************************************************/int random_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, aout_buffer_t * p_buffer , picture_t * p_picture){ int i_nb_plots; char *psz_parse= NULL; int i , i_y , i_u , i_v; int i_position; srand((unsigned int)mdate()); if( p_effect->psz_args ) { psz_parse = strdup( p_effect->psz_args ); i_nb_plots = config_GetInt ( p_aout, "visual-stars" ); } else { i_nb_plots = 200; } for( i = 0 ; i < i_nb_plots ; i++ ) { i_position = rand() % (p_effect->i_width * p_effect->i_height ); i_y = rand() % 256; i_u = rand() % 256; i_v = rand() % 256; *(p_picture->p[0].p_pixels + i_position )= i_u; *(p_picture->p[1].p_pixels + i_position/4) = i_v; *(p_picture->p[2].p_pixels + i_position/4) = i_y; } return 0;}/***************************************************************************** * blur_Run: blur effect *****************************************************************************/#if 0 /* This code is totally crappy */int blur_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, aout_buffer_t * p_buffer , picture_t * p_picture){ uint8_t * p_pictures; int i,j; int i_size; /* Total size of one image */ i_size = (p_picture->p[0].i_pitch * p_picture->p[0].i_lines + p_picture->p[1].i_pitch * p_picture->p[1].i_lines + p_picture->p[2].i_pitch * p_picture->p[2].i_lines ); if( !p_effect->p_data ) { p_effect->p_data=(void *)malloc( 5 * i_size *sizeof(uint8_t)); if( !p_effect->p_data) { msg_Err(p_aout,"Out of memory"); return -1; } p_pictures = (uint8_t *)p_effect->p_data; } else { p_pictures =(uint8_t *)p_effect->p_data; } for( i = 0 ; i < 5 ; i++) { for ( j = 0 ; j< p_picture->p[0].i_pitch * p_picture->p[0].i_lines; i++) p_picture->p[0].p_pixels[j] = p_pictures[i * i_size + j] * (100 - 20 * i) /100 ; for ( j = 0 ; j< p_picture->p[1].i_pitch * p_picture->p[1].i_lines; i++) p_picture->p[1].p_pixels[j] = p_pictures[i * i_size + p_picture->p[0].i_pitch * p_picture->p[0].i_lines + j ]; for ( j = 0 ; j< p_picture->p[2].i_pitch * p_picture->p[2].i_lines; i++) p_picture->p[2].p_pixels[j] = p_pictures[i * i_size + p_picture->p[0].i_pitch * p_picture->p[0].i_lines + p_picture->p[1].i_pitch * p_picture->p[1].i_lines + j ]; } memcpy ( &p_pictures[ i_size ] , &p_pictures[0] , 4 * i_size * sizeof(uint8_t) );}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -