// File: conv2d.cpp
// Binding harness: computes H_out/W_out from constexpr params, calls inner_conv2d.
// ABI: armbench_entry_conv2d(input*, output*, weight*, bias*, N, C_in, H, W, C_out)
// Input layout: (N, C_in, H, W); weight layout: (C_out, C_in, Kh, Kw); output layout: (N, C_out, H_out, W_out).
#include "conv2d.h"
using namespace conv2d_def;

extern "C" int armbench_entry_conv2d(
    const float* input, float* output,
    const float* weight, const float* bias,
    int N, int C_in, int H, int W, int C_out)
{
    constexpr int ext_kh = Dh * (Kh - 1) + 1;
    constexpr int ext_kw = Dw * (Kw - 1) + 1;
    const int H_out = (H + 2 * pad_top  - ext_kh) / Sh + 1;
    const int W_out = (W + 2 * pad_left - ext_kw) / Sw + 1;
    inner_conv2d(input, output, weight, bias, N, C_in, H, W, C_out, H_out, W_out);
    return 0;
}