int process_instance( livido_port_t *my_instance, double timecode ) { int len =0; uint8_t *O[4]= {NULL,NULL,NULL,NULL}; int palette; int w; int h; //@ get output channel details int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); if( error != LIVIDO_NO_ERROR ) return LIVIDO_ERROR_NO_OUTPUT_CHANNELS; //@ error codes in livido flanky int uv_len = lvd_uv_plane_len( palette,w,h ); len = w * h; starfield_t *starfield = NULL; if ( livido_property_get( my_instance, "PLUGIN_private", 0, &starfield ) != LIVIDO_NO_ERROR ) return LIVIDO_ERROR_INTERNAL; //@ get parameter values int number_of_stars = lvd_extract_param_index( my_instance,"in_parameters", 0 ); int speed = 2 + lvd_extract_param_index( my_instance, "in_parameters", 1 ); livido_memset( O[0], 0, len ); livido_memset( O[1], 128, uv_len ); livido_memset( O[2], 128, uv_len ); int center_x = w >> 1; int center_y = h >> 1; int i; int temp_x, temp_y; STAR **stars = starfield->stars; for( i = 0; i < number_of_stars; i ++ ) { stars[i]->zpos -= stars[i]->speed; if( stars[i]->zpos <= 0 ) { init_star( stars[i], i + 1, speed ); } temp_x = (stars[i]->xpos / stars[i]->zpos ) + center_x; temp_y = (stars[i]->ypos / stars[i]->zpos ) + center_y; if( temp_x < 0 || temp_x > (w-1) || temp_y < 0 || temp_y > (h-1) ) { init_star( stars[i], i + 1, speed ); continue; } O[0][ temp_y * w + temp_x ] = stars[i]->color; } return LIVIDO_NO_ERROR; }
livido_process_f process_instance( livido_port_t *my_instance, double timecode ) { int len =0; int i = 0; uint8_t *A[4] = {NULL,NULL,NULL,NULL}; uint8_t *O[4]= {NULL,NULL,NULL,NULL}; int palette; int w; int h; int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); if( error != LIVIDO_NO_ERROR ) return LIVIDO_ERROR_HARDWARE; lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); int uv_len = lvd_uv_plane_len( palette,w,h ); len = w * h; int red = lvd_extract_param_index( my_instance,"in_parameters", 0 ); int green = lvd_extract_param_index( my_instance,"in_parameters", 1 ); int blue = lvd_extract_param_index( my_instance,"in_parameters", 2 ); int shift = 1; if( palette == LIVIDO_PALETTE_YUV444P ) shift = 0; if( O[0] != A[0] ) { livido_memcpy( A[0], O[0], len ); } int y,u,v; GIMP_rgb2yuv( red, green, blue, y, u, v ); livido_memset( O[1], u, uv_len ); livido_memset( O[2], v, uv_len ); return LIVIDO_NO_ERROR; }