For 𝑖 = 1 to 𝑘 1
 For 𝑗 = 1 to 𝑘 2
For 𝑘 = 1 to 4 //window size = 4 × 3
             For 𝑙 = 1 to 3
            If ( 𝑖 == 1 && 𝑗 == 1)
                  𝑤 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) = 𝑊 n e w
            Else if( 𝑗 == 𝑘 2 )
                  𝑤 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) = 𝑤 ( 𝑖 1 , 𝑗 , 𝑘 , 𝑙 ) ;//next 𝑖
            //[Dvw1 = 1 0 0 0]
            Else
             𝑤 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) = 𝑤 ( 𝑖 , 𝑗 1 , 𝑘 , 𝑙 ) ;
            // next 𝑗 [Dvw2 = 0 1 0 0]
            End if
  If ( 𝑖 == 1 && 𝑗 == 1)
   𝐼 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) = 𝐼 n e w ;
  Else if( 𝑖 == 1 && 𝑗 > 1) // first row—second window calculation
   𝐼 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) = 𝐼 ( 𝑖 , 𝑗 + 1 , 𝑘 , 𝑙 + 1 ) ; move to the next 𝑗 pixel – 𝑗 + 1; pixel data—reads in next column of pixel and
  old data is moved in the ( 𝑘 , 𝑙 ) plane-PE_array from ( 𝑘 , 𝑙 ) to ( 𝑘 , 𝑙 + 1);//[ 𝐃 𝐕 𝐱 𝟐 = 0 1 0 1]
  Else if (j==k 𝟐 )    // for next 𝑖
   𝐼 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) = 𝐼 ( 𝑖 + 1 , 𝑗 , 𝑘 + 1 , 𝑙 ) ; // move to the next 𝑖 pixel 𝑖 + 1; pixel data—reads in next row of
  // pixel and old data is moved in the ( 𝑘 , 𝑙 ) plane-PE_array from ( 𝑘 , 𝑙 ) to ( 𝑘 + 1 , 𝑙 )
  //[ 𝐃 𝐕 𝐱 𝟏 = 1 0 1 0]
  End if
  If ( 𝑙 ==1 && 𝑘 == 1)
   𝑂 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) = 0;
  Else if (k < 3)
   𝑂 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) = 𝑂 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 1 ) + 𝐼 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) 𝑊 ( 𝐼 , 𝑗 , 𝑘 , 𝑙 ) ;
  Else
   𝑂 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) = 𝑂 ( 𝑖 , 𝑗 , 𝑘 1 , 𝑙 ) + 𝐼 ( 𝑖 , 𝑗 , 𝑘 , 𝑙 ) 𝑊 ( 𝐼 , 𝑗 , 𝑘 , 𝑙 ) ;
  End;
End For 𝑙 , 𝑘 , 𝑗 , 𝑖 ;
Listing 3: URE algorithm for 2D filtering.