---
title: kml_fft(f/h)_plan_upsampling_2d
description: "建立单个连续数据序列2维上采样变换的plan。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0354.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0354.html
indexId: 21a3aee725fdcedda95a4e5d8b87e6b779d5e1b785c075f838772668b7899d7f61
---
# kml_fft(f/h)_plan_upsampling_2d

建立单个连续数据序列2维上采样变换的plan。

#### 接口定义

C interface：

kml_fft_plan kml_fft_plan_upsampling_2d(int n0, int n1, int n0_result, int n1_result, double s0, double s1, double *in_, double *out_, unsigned flags);

kml_fftf_plan kml_fftf_plan_upsampling_2d(int n0, int n1, int n0_result, int n1_result, float s0, float s1, float *in_, float *out_, unsigned flags);

kml_ffth_plan kml_ffth_plan_upsampling_2d(int n0, int n1, int n0_result, int n1_result, __fp16 s0, __fp16 s1, __fp16 *in_, __fp16 *out_, unsigned flags);


#### 参数

| 参数名 | 数据类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| n0 | int | 输入图像的行数。 | 输入 |
| n1 | int | 输入图像的列数。 | 输入 |
| n0\_result | int | 输出图像的行数。 | 输入 |
| n1\_result | int | 输出图像的列数。 | 输入 |
| s0 | 双精度：double 单精度：float 半精度：\_\_fp16 | shift操作的x分量。 | 输入 |
| s1 | 双精度：double 单精度：float 半精度：\_\_fp16 | shift操作的y分量。 | 输入 |
| in | 双精度：double\* 单精度：float\* 半精度：\_\_fp16\* | 输入图像的内存指针。 | 输入 |
| out | 双精度：double\* 单精度：float\* 半精度：\_\_fp16\* | 输出图像的内存指针。 | 输出 |
| flags | unsigned | planning选项，未使用。 | 输入 |


#### 依赖

C: "kfft.h"


#### 示例

C interface：

```
int n0 = 3;
int n1 = 3;
int n0_result=7;
int n1_result=7;
double init[9] = {0, 1, 0, 1, 0, 1, 0, 1, 0};
double *in;
in = (double*)kml_fft_malloc(sizeof(double) * n0 * n1);
for (int i = 0; i < n0 * n1; i++) {
in[i] = init[i];
}
double *out;
out = (double*)kml_fft_malloc(sizeof(double) * n0_result * n1_result);
kml_fft_plan plan;
plan = kml_fft_plan_upsampling_2d(n0, n1, n0_result, n1_result, 0, 0, in, out, KML_FFT_ESTIMATE);
kml_fft_execute(plan);
kml_fft_destroy_plan(plan);
kml_fft_free(in);
kml_fft_free(out);
/*
* out = {0.000000, 0.105960, 0.178233, 0.162397, 0.070375, -0.028537, -0.059857,
*        0.105960, 0.089665, 0.078550, 0.080985, 0.095137, 0.110349, 0.115165,
*        0.178233, 0.078550, 0.010558, 0.025457, 0.112027, 0.205080, 0.234545,
*        0.162397, 0.080985, 0.025457, 0.037624, 0.108326, 0.184322, 0.208386,
*        0.070375, 0.095137, 0.112027, 0.108326, 0.086821, 0.063706, 0.056387,
*        -0.028537, 0.110349, 0.205080, 0.184322, 0.063706, -0.065941, -0.106993,
*        -0.059857, 0.115165, 0.234545, 0.208386, 0.056387, -0.106993, -0.158727}
*/
```
