@@ -388,12 +388,8 @@ PHP_FUNCTION(opencv_absdiff){
388388 &dst_zval) == FAILURE) {
389389 RETURN_NULL ();
390390 }
391- // opencv_mat_object *src1_mat_object = NULL, *src2_mat_object = NULL, *dst_mat_object = NULL;
392- // opencv_scalar_object *src1_scalar_object = NULL, *src2_scalar_object = NULL, *dst_scalar_object = NULL;
393-
394- void *tmp_src1 = NULL ;
395- void *tmp_src2 = NULL ;
396- void *tmp_dst = NULL ;
391+ opencv_mat_object *src1_mat_object = NULL , *src2_mat_object = NULL , *dst_mat_object = NULL ;
392+ opencv_scalar_object *src1_scalar_object = NULL , *src2_scalar_object = NULL , *dst_scalar_object = NULL ;
397393
398394 int flag = 0 ;// 1 mat,0 scalar
399395
@@ -405,10 +401,10 @@ PHP_FUNCTION(opencv_absdiff){
405401 }
406402
407403 if (Z_OBJCE_P (src1_zval) == opencv_mat_ce){
408- tmp_src1 = Z_PHP_MAT_OBJ_P (src1_zval);
404+ src1_mat_object = Z_PHP_MAT_OBJ_P (src1_zval);
409405 flag |= (1 <<1 );
410406 }else if (Z_OBJCE_P (src1_zval) == opencv_scalar_ce){
411- tmp_src1 = Z_PHP_SCALAR_OBJ_P (src1_zval);
407+ src1_scalar_object = Z_PHP_SCALAR_OBJ_P (src1_zval);
412408 }else {
413409 char *error_message = (char *)malloc (strlen (" src1 parameter must be Mat or Scalar object." ) + 1 );
414410 strcpy (error_message," src1 parameter must be Mat or Scalar object." );
@@ -424,10 +420,10 @@ PHP_FUNCTION(opencv_absdiff){
424420 }
425421
426422 if (Z_OBJCE_P (src2_zval) == opencv_mat_ce){
427- tmp_src2 = Z_PHP_MAT_OBJ_P (src2_zval);
423+ src2_mat_object = Z_PHP_MAT_OBJ_P (src2_zval);
428424 flag |= (1 <<0 );
429425 }else if (Z_OBJCE_P (src2_zval) == opencv_scalar_ce){
430- tmp_src2 = Z_PHP_SCALAR_OBJ_P (src2_zval);
426+ src2_scalar_object = Z_PHP_SCALAR_OBJ_P (src2_zval);
431427 }else {
432428 char *error_message = (char *)malloc (strlen (" src2 parameter must be Mat or Scalar object." ) + 1 );
433429 strcpy (error_message," src2 parameter must be Mat or Scalar object." );
@@ -439,41 +435,42 @@ PHP_FUNCTION(opencv_absdiff){
439435
440436 if (flag == 0 ){ // both scalar
441437 if (Z_TYPE_P (dst_real_zval) == IS_OBJECT && Z_OBJCE_P (dst_real_zval)==opencv_scalar_ce){
442- tmp_dst = Z_PHP_SCALAR_OBJ_P (dst_real_zval);
438+ dst_scalar_object = Z_PHP_SCALAR_OBJ_P (dst_real_zval);
443439 } else {
444440 zval instance;
445441 Scalar dst;
446442 object_init_ex (&instance,opencv_scalar_ce);
447443 ZVAL_COPY_VALUE (dst_real_zval, &instance);
448- tmp_dst = Z_PHP_SCALAR_OBJ_P (dst_real_zval);
449- tmp_dst ->scalar = new Scalar (dst);
444+ dst_scalar_object = Z_PHP_SCALAR_OBJ_P (dst_real_zval);
445+ dst_scalar_object ->scalar = new Scalar (dst);
450446 }
451447
452- absdiff (*tmp_src1-> mat ,*tmp_src2-> mat , *tmp_dst-> mat );
453- opencv_mat_update_property_by_c_mat (dst_real_zval, tmp_dst-> mat );
448+ absdiff (*src1_scalar_object-> scalar ,*src2_scalar_object-> scalar , *dst_scalar_object-> scalar );
449+ opencv_scalar_update_property_by_c_scalar (dst_real_zval, dst_scalar_object-> scalar );
454450 }else {
455451 if (Z_TYPE_P (dst_real_zval) == IS_OBJECT && Z_OBJCE_P (dst_real_zval)==opencv_mat_ce){
456- tmp_dst = Z_PHP_MAT_OBJ_P (dst_real_zval);
452+ dst_mat_object = Z_PHP_MAT_OBJ_P (dst_real_zval);
457453 } else {
458454 zval instance;
459455 Mat dst;
460456 object_init_ex (&instance,opencv_mat_ce);
461457 ZVAL_COPY_VALUE (dst_real_zval, &instance);
462- tmp_dst = Z_PHP_MAT_OBJ_P (dst_real_zval);
463- tmp_dst->mat = new Mat (dst);
458+
459+ dst_mat_object = Z_PHP_MAT_OBJ_P (dst_real_zval);
460+ dst_mat_object->mat = new Mat (dst);
464461 }
465462 switch (flag){
466463 case 1 :
467- absdiff (*tmp_src1 ->scalar ,*tmp_src2 ->mat , *tmp_dst ->mat );
468- opencv_mat_update_property_by_c_mat (dst_real_zval, tmp_dst ->mat );
464+ absdiff (*src1_scalar_object ->scalar ,*src2_mat_object ->mat , *dst_mat_object ->mat );
465+ opencv_mat_update_property_by_c_mat (dst_real_zval, dst_mat_object ->mat );
469466 break ;
470467 case 10 :
471- absdiff (*tmp_src1 ->mat ,*tmp_src2 ->scalar , *tmp_dst ->mat );
472- opencv_mat_update_property_by_c_mat (dst_real_zval, tmp_dst ->mat );
468+ absdiff (*src1_mat_object ->mat ,*src2_scalar_object ->scalar , *dst_mat_object ->mat );
469+ opencv_mat_update_property_by_c_mat (dst_real_zval, dst_mat_object ->mat );
473470 break ;
474471 case 11 :
475- absdiff (*tmp_src1 ->mat ,*tmp_src2 ->mat , *tmp_dst ->mat );
476- opencv_mat_update_property_by_c_mat (dst_real_zval, tmp_dst ->mat );
472+ absdiff (*src1_mat_object ->mat ,*src2_mat_object ->mat , *dst_mat_object ->mat );
473+ opencv_mat_update_property_by_c_mat (dst_real_zval, dst_mat_object ->mat );
477474 break ;
478475 default :
479476 break ;
0 commit comments