@@ -25,7 +25,9 @@ namespace
2525constexpr unsigned int MaxStripeHeight = 3072 ;
2626// Precision for the scaler blocks
2727constexpr unsigned int ScalePrecision = 12 ;
28- constexpr unsigned int UnityScale = 1 << 12 ;
28+ constexpr unsigned int PhasePrecision = 12 ;
29+ constexpr unsigned int UnityScale = 1 << ScalePrecision;
30+ constexpr unsigned int UnityPhase = 1 << PhasePrecision;
2931// PPF properties
3032constexpr unsigned int ResamplePrecision = 10 ;
3133constexpr unsigned int NumPhases = 16 ;
@@ -837,8 +839,8 @@ std::vector<pisp_tile> BackEnd::retilePipeline(TilingConfig const &tiling_config
837839 unsigned int frac_y = (resample_size.y .offset * be_config_.downscale [j].scale_factor_v ) &
838840 ((1 << ScalePrecision) - 1 );
839841 // Fractional component of the input required to generate the output pixel.
840- t.downscale_phase_x [p * variant_.BackEndNumBranches (0 ) + j] = (UnityScale - frac_x);
841- t.downscale_phase_y [p * variant_.BackEndNumBranches (0 ) + j] = (UnityScale - frac_y);
842+ t.downscale_phase_x [p * variant_.BackEndNumBranches (0 ) + j] = (UnityPhase - frac_x);
843+ t.downscale_phase_y [p * variant_.BackEndNumBranches (0 ) + j] = (UnityPhase - frac_y);
842844 }
843845
844846 if (be_config_.global .rgb_enables & PISP_BE_RGB_ENABLE_RESAMPLE (j))
@@ -859,15 +861,15 @@ std::vector<pisp_tile> BackEnd::retilePipeline(TilingConfig const &tiling_config
859861 t.resample_phase_y [p * variant_.BackEndNumBranches (0 ) + j] +=
860862 be_config_extra_.resample [j].initial_phase_v [p];
861863 // Have to be within this range, else some calculation went wrong.
862- PISP_ASSERT (t.resample_phase_x [p * variant_.BackEndNumBranches (0 ) + j] <= 2 * (UnityScale - 1 ));
863- PISP_ASSERT (t.resample_phase_y [p * variant_.BackEndNumBranches (0 ) + j] <= 2 * (UnityScale - 1 ));
864+ PISP_ASSERT (t.resample_phase_x [p * variant_.BackEndNumBranches (0 ) + j] <= ( 2 * UnityPhase - 1 ));
865+ PISP_ASSERT (t.resample_phase_y [p * variant_.BackEndNumBranches (0 ) + j] <= ( 2 * UnityPhase - 1 ));
864866 }
865867 }
866868
867869 // Phase difference between planes cannot be > 0.5 pixels on the output dimenstions.
868870 if (be_config_.global .rgb_enables & PISP_BE_RGB_ENABLE_RESAMPLE (j))
869871 {
870- int phase_max = (be_config_.resample [j].scale_factor_h * UnityScale / 2 ) >> ScalePrecision;
872+ int phase_max = (be_config_.resample [j].scale_factor_h * UnityPhase / 2 ) >> ScalePrecision;
871873 if (std::abs (t.resample_phase_x [0 * variant_.BackEndNumBranches (0 ) + j] -
872874 t.resample_phase_x [1 * variant_.BackEndNumBranches (0 ) + j]) > phase_max ||
873875 std::abs (t.resample_phase_x [1 * variant_.BackEndNumBranches (0 ) + j] -
@@ -877,7 +879,7 @@ std::vector<pisp_tile> BackEnd::retilePipeline(TilingConfig const &tiling_config
877879 {
878880 throw std::runtime_error (" Resample phase x for tile is > 0.5 pixels on the output dimensions." );
879881 }
880- phase_max = (be_config_.resample [j].scale_factor_v * UnityScale / 2 ) >> ScalePrecision;
882+ phase_max = (be_config_.resample [j].scale_factor_v * UnityPhase / 2 ) >> ScalePrecision;
881883 if (std::abs (t.resample_phase_y [0 * variant_.BackEndNumBranches (0 ) + j] -
882884 t.resample_phase_y [1 * variant_.BackEndNumBranches (0 ) + j]) > phase_max ||
883885 std::abs (t.resample_phase_y [1 * variant_.BackEndNumBranches (0 ) + j] -
0 commit comments