onnxruntime/test/shared_lib/fns_candy_style_transfer.c
static void hwc_to_chw(const png_byte* input, size_t h, size_t w, float** output, size_t* output_count) {
  size_t stride = h * w;
  *output_count = stride * 3;
  float* output_data = (float*)malloc(*output_count * sizeof(float));
  for (size_t i = 0; i != stride; ++i) {
    for (size_t c = 0; c != 3; ++c) {
      output_data[c * stride + i] = input[i * 3 + c];
    }
  }
  *output = output_data;
}
/**
 * convert input from HWC format to CHW format
 * \param input A single image. The byte array has length of 3*h*w
 * \param h image height
 * \param w image width
 * \param output A float array. should be freed by caller after use
 * \param output_count Array length of the `output` param
 */
convert input from HWC format to CHW format
\param input A single image. The byte array has length of 3*h*w
\param h image height
\param w image width
\param output A float array. should be freed by caller after use
\param output_count Array length of the `output` param
convert input from HWC format to CHW format \ param input A single image . The byte array has length of 3 * h * w \ param h image height \ param w image width \ param output A float array . should be freed by caller after use \ param output_count Array length of the ` output ` param
static void hwc_to_chw(const png_byte* input, size_t h, size_t w, float** output, size_t* output_count) {
  size_t stride = h * w;
  *output_count = stride * 3;
  float* output_data = (float*)malloc(*output_count * sizeof(float));
  for (size_t i = 0; i != stride; ++i) {
    for (size_t c = 0; c != 3; ++c) {
      output_data[c * stride + i] = input[i * 3 + c];
    }
  }
  *output = output_data;
}
static void hwc_to_chw ( const png_byte * input , size_t h , size_t w , float * * output , size_t * output_count ) { size_t stride = h * w ; * output_count = stride * 3 ; float * output_data = ( float * ) malloc ( * output_count * sizeof ( float ) ) ; for ( size_t i = 0 ; i != stride ; ++ i ) { for ( size_t c = 0 ; c != 3 ; ++ c ) { output_data [ c * stride + i ] = input [ i * 3 + c ] ; } } * output = output_data ; }
convert input from HWC format to CHW format
 \param input A single image.
convert input from HWC format to CHW format \ param input A single image .