static int lvd_crop_plane( uint8_t *D, uint8_t *S, int left, int right, int top, int bottom, int w, int h ) { int dst_width = ( w - left - right); int y = h - top - bottom + 1; if( dst_width < 1 || y < 1) return 0; uint8_t *src = S; uint8_t *dst = D; while( --y ) { livido_memcpy( dst, src, dst_width); dst += dst_width; src += w; } return 1; }
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; }