[vlc-devel] [PATCH] Puzzle filter enhancement
Jean-Baptiste Kempf
jb at videolan.org
Thu Feb 7 15:50:58 CET 2013
On 06 Feb, Vianney Boyer wrote :
> +int puzzle_bake_piece( filter_t *p_filter)
Function is too long, please split.
> +void puzzle_solve_pces_group( filter_t *p_filter) {
> + for (uint32_t i_piece_B = 0; i_piece_B < p_sys->s_allocated.i_pieces_nbr; i_piece_B++) {
> + piece_t *ps_piece_B = &p_sys->ps_pieces[i_piece_B];
> + if ( ps_piece_A->i_actual_angle == ps_piece_B->i_actual_angle && ps_piece_A->i_actual_mirror == ps_piece_B->i_actual_mirror ) {
invert this if and put continue;
> + if ( (ps_piece_B->i_group_ID != p_sys->ps_pieces[i_piece_A].i_group_ID ) ) {
> + if ( abs(ps_piece_A->i_OTy - ps_piece_B->i_OTy )<3) {
> + if (abs( ps_piece_A->i_ORx - ps_piece_B->i_OLx + 1 )<3) {
> + if ( ( abs( ps_piece_A->i_TRx - ps_piece_B->i_TLx + 1 ) < p_sys->i_magnet_accuracy ) && ( abs( ps_piece_A->i_TRy - ps_piece_B->i_TLy ) < p_sys->i_magnet_accuracy ) &&
> + ( abs( ps_piece_A->i_BRx - ps_piece_B->i_BLx + 1 ) < p_sys->i_magnet_accuracy ) && ( abs( ps_piece_A->i_BRy - ps_piece_B->i_BLy ) < p_sys->i_magnet_accuracy ) ) {
Merge those 2 if
> + i_dx = ps_piece_A->i_TRx - ps_piece_B->i_TLx + ps_piece_A->i_step_x_x;
> + i_dy = ps_piece_A->i_TRy - ps_piece_B->i_TLy;
> +
> + if (!ps_piece_B->b_finished)
> + puzzle_move_group( p_filter, i_piece_B, i_dx, i_dy);
> + else
> + puzzle_move_group( p_filter, i_piece_A, -i_dx, -i_dy);
> +
> + uint32_t i_group_ID = ps_piece_B->i_group_ID;
> + for (uint32_t i_for = 0; i_for < p_sys->s_allocated.i_pieces_nbr; i_for++)
> + if ( p_sys->ps_pieces[i_for].i_group_ID == i_group_ID)
> + p_sys->ps_pieces[i_for].i_group_ID = p_sys->ps_pieces[i_piece_A].i_group_ID;
> + }
> + }
> + }
> + else if ( abs(ps_piece_A->i_OLx - ps_piece_B->i_OLx )<3) {
> + if ( abs(ps_piece_A->i_OBy - ps_piece_B->i_OTy + 1 )<3) {
> + if ( ( abs( ps_piece_B->i_TLx - ps_piece_A->i_BLx ) < p_sys->i_magnet_accuracy ) && ( abs( ps_piece_B->i_TLy - 1 - ps_piece_A->i_BLy ) < p_sys->i_magnet_accuracy ) &&
> + ( abs( ps_piece_B->i_TRx - ps_piece_A->i_BRx ) < p_sys->i_magnet_accuracy ) && ( abs( ps_piece_B->i_TRy - 1 - ps_piece_A->i_BRy ) < p_sys->i_magnet_accuracy ) ) {
idem
> + if ( abs( ps_piece_A->i_OTy - ps_piece_B->i_OTy )<3 ) {
> + if ( abs( ps_piece_A->i_ORx - ps_piece_B->i_OLx + 1 )<3 )
> + if ( ( abs( ps_piece_A->i_TRx - ps_piece_B->i_TLx + 1 ) < p_sys->i_magnet_accuracy ) && ( abs( ps_piece_A->i_TRy - ps_piece_B->i_TLy ) < p_sys->i_magnet_accuracy ) &&
> + ( abs( ps_piece_A->i_BRx - ps_piece_B->i_BLx + 1 ) < p_sys->i_magnet_accuracy ) && ( abs( ps_piece_A->i_BRy - ps_piece_B->i_BLy ) < p_sys->i_magnet_accuracy ) ) {
Same here.
> +
> + ps_piece->b_finished = false;
> + if ( ps_piece->i_actual_mirror == 1 )
> + if ( abs( ps_piece->i_TRx - ps_piece->i_ORx ) < p_sys->i_magnet_accuracy )
> + if ( abs( ps_piece->i_TRy - ps_piece->i_OTy ) < p_sys->i_magnet_accuracy )
> + if ( abs( ps_piece->i_TLx - ps_piece->i_OLx ) < p_sys->i_magnet_accuracy )
> + if ( abs( ps_piece->i_TLy - ps_piece->i_OTy ) < p_sys->i_magnet_accuracy ) {
Plese merge those.
> +int puzzle_sort_layers( filter_t *p_filter)
> +{
> + filter_sys_t *p_sys = p_filter->p_sys;
> +
> + /* sort */
More info?
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the vlc-devel
mailing list