| 41 | common_tran.GetDependInternalSymbol(ctx)}}; |
| 42 | } |
| 43 | std::string CvTransposeKernel::GetCVKernelBody(TContext* context) const { |
| 44 | GeneralIntrinsic::CommonTransposeKernel common_tran; |
| 45 | std::shared_ptr<TContext> tran_ctx = std::make_shared<CodeGenContext>(); |
| 46 | auto kernel_sig = GetCVKernelSignature(context); |
| 47 | auto dtype_str = context->getAttrOprand("operand:0").dtype; |
| 48 | int32_t type_size = Utils::get_dtype_size(dtype_str); |
| 49 | tran_ctx->setAttr("type_size", CCAttr(type_size)); |
| 50 | std::string body_temp = R"( |
| 51 | #include <string.h> |
| 52 | #include "gi_int.h" |
| 53 | #include "tinycv_c.h" |
| 54 | |
| 55 | ${gi_fast_transpose_impl} |
| 56 | |
| 57 | void ${kernel_sig}{ |
| 58 | uint8_t * src_base_ptr = src->data; |
| 59 | uint8_t * dst_base_ptr = dst->data; |
| 60 | int src_cols = src->cols; |
| 61 | int src_rows = src->rows; |
| 62 | int src_chans = src->channels; |
| 63 | fast_transpose_impl_8(src_base_ptr, dst_base_ptr, src_cols, src_rows, src_chans, src_cols * src_chans, src_rows * src_chans); |
| 64 | } |
| 65 | )"; |
| 66 | return StringTemplate::StringTemplateArgs() |
| 67 | .add("kernel_sig", kernel_sig) |
| 68 | .add("gi_fast_transpose_impl", |
| 69 | common_tran.GetKernelSignature(tran_ctx.get())) |
| 70 | .render(body_temp); |
| 71 | } |
| 72 | |
| 73 | // vim: syntax=cpp.doxygen |
nothing calls this directly
no test coverage detected