MCPcopy Create free account
hub / github.com/MegEngine/MegCC / GetCVKernelBody

Method GetCVKernelBody

compiler/lib/KernelGen/BareMetal/CvtColor.cpp:271–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271std::string CvtColorKernel::GetCVKernelBody(TContext* context) const {
272 auto kernel_sig = GetCVKernelSignature(context);
273 auto mode = context->getAttrStr("mode");
274 auto gen_func = g_cvt_reg.get_func(mode);
275 auto code = gen_func(context);
276 std::string body_temp = R"(
277 #include <limits.h>
278 #include <string.h>
279 #include "tinycv_c.h"
280 ${aux_func}
281 void ${kernel_sig}{
282 uint8_t * sptr = src->data;
283 uint8_t * dptr = dst->data;
284 size_t rows = src->rows;
285 size_t cols = src->cols;
286 size_t hw = rows * cols;
287 size_t ch = src->channels;
288
289 ${cvt_code}
290
291 }
292 )";
293
294 return StringTemplate::StringTemplateArgs()
295 .add("aux_func", code.aux_func)
296 .add("cvt_code", code.cvt_code)
297 .add("kernel_sig", kernel_sig)
298 .render(body_temp);
299}
300
301// vim: syntax=cpp.doxygen

Callers

nothing calls this directly

Calls 5

StringTemplateArgsClass · 0.85
getAttrStrMethod · 0.80
get_funcMethod · 0.45
renderMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected