COMPMID-1634: Cleaned up NEPoolingLayer.

Reduced the binary size of NEPoolingLayerKernel.o form 266k to 95K

Change-Id: Ia1e79849430a5f34f5c1fa3fb15f23a61555a7f0
Reviewed-on: https://review.mlplatform.org/344
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
diff --git a/arm_compute/core/NEON/kernels/NEPoolingLayerKernel.h b/arm_compute/core/NEON/kernels/NEPoolingLayerKernel.h
index 6c4c1db..5f45a90 100644
--- a/arm_compute/core/NEON/kernels/NEPoolingLayerKernel.h
+++ b/arm_compute/core/NEON/kernels/NEPoolingLayerKernel.h
@@ -78,101 +78,116 @@
 private:
     /** Function to perform 2x2 pooling.
      *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
      */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void pooling2_f32_nchw(const Window &window_input, const Window &window);
-    /** Function to perform 2x2 pooling for float16_t.
-     *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
-     */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void pooling2_f16_nchw(const Window &window_input, const Window &window);
-    /** Function to perform 2x2 pooling for 8bit asymmetric fixed point.
-     *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
-     */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void pooling2_qasymm8_nchw(const Window &window_input, const Window &window);
-    /** Function to perform 3x3 pooling.
-     *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
-     */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void pooling3_f32_nchw(const Window &window_input, const Window &window);
-    /** Function to perform 3x3 pooling.
-     *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
-     */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void pooling3_f16_nchw(const Window &window_input, const Window &window);
-    /** Function to perform 3x3 pooling for 8bit quantized fixed point.
-     *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
-     */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void pooling3_qasymm8_nchw(const Window &window_input, const Window &window);
-    /** Function to perform 7x7 pooling.
-     *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
-     */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void pooling7_f32_nchw(const Window &window_input, const Window &window);
-    /** Function to perform MxN pooling for 8-bit quantized.
-     *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
-     */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void poolingMxN_qasymm8_nchw(const Window &window_input, const Window &window);
-    /** Function to perform MxN pooling for 8-bit quantized. (NHWC)
-     *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
-     */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void poolingMxN_qasymm8_nhwc(const Window &window_input, const Window &window);
-    /** Function to perform MxN pooling for 16-bit floating point values.
-     *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
-     */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void poolingMxN_f16_nchw(const Window &window_input, const Window &window);
-    /** Function to perform MxN pooling for 16-bit floating point values. (NHWC)
-     *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
-     */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void poolingMxN_f16_nhwc(const Window &window_input, const Window &window);
+    void pooling2_f32_nchw(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
     /** Function to perform MxN pooling for 32-bit floating point values.
      *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
      */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void poolingMxN_f32_nchw(const Window &window_input, const Window &window);
+    void poolingMxN_f32_nchw(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
     /** Function to perform MxN pooling for 32-bit floating point values (NHWC).
      *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
      */
-    template <PoolingType pooling_type, bool exclude_padding = false>
-    void poolingMxN_f32_nhwc(const Window &window_input, const Window &window);
+    void poolingMxN_f32_nhwc(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
+    /** Function to perform 7x7 pooling.
+     *
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
+     */
+    void pooling7_f32_nchw(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
+    /** Function to perform 3x3 pooling.
+     *
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
+     */
+    void pooling3_f32_nchw(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
+    /** Function to perform 2x2 pooling for float16_t.
+     *
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
+     */
+    void pooling2_f16_nchw(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
+    /** Function to perform 3x3 pooling.
+     *
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
+     */
+    void pooling3_f16_nchw(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
+    /** Function to perform MxN pooling for 16-bit floating point values.
+     *
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
+     */
+    void poolingMxN_f16_nchw(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
+    /** Function to perform MxN pooling for 16-bit floating point values. (NHWC)
+     *
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
+     */
+    void poolingMxN_f16_nhwc(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
+    /** Function to perform 2x2 pooling for 8bit asymmetric fixed point.
+     *
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
+     */
+    void pooling2_qasymm8_nchw(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
+    /** Function to perform 3x3 pooling for 8bit quantized fixed point.
+     *
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
+     */
+    void pooling3_qasymm8_nchw(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
+    /** Function to perform MxN pooling for 8-bit quantized.
+     *
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
+     */
+    void poolingMxN_qasymm8_nchw(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
+    /** Function to perform MxN pooling for 8-bit quantized. (NHWC)
+     *
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
+     */
+    void poolingMxN_qasymm8_nhwc(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding = false);
     /** Common signature for all the specialised Pooling functions
      *
-     * @param[in] window_input Input region on which to execute the kernel.
-     * @param[in] window       Output region on which to execute the kernel.
+     * @param[in] window_input    Input region on which to execute the kernel.
+     * @param[in] window          Output region on which to execute the kernel.
+     * @param[in] pooling_type    Pooling operation to be computed.
+     * @param[in] exclude_padding Flag to specify exclusion of padding from the operation.
      */
-    using PoolingFunction = void (NEPoolingLayerKernel::*)(const Window &window_input, const Window &window);
+    using PoolingFunction = void (NEPoolingLayerKernel::*)(const Window &window_input, const Window &window, PoolingType pooling_type, bool exclude_padding);
 
 private:
     PoolingFunction  _func;