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

Method GetCVKernelBody

compiler/lib/KernelGen/Arm/ArmCommon/CvtColor.cpp:453–482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

451}
452
453std::string CvtColorKernel::GetCVKernelBody(TContext* context) const {
454 auto kernel_sig = GetCVKernelSignature(context);
455 auto mode = context->getAttrStr("mode");
456 auto gen_func = g_cvt_reg.get_func(mode);
457 auto code = gen_func(context);
458 std::string body_temp = R"(
459 #include <arm_neon.h>
460 #include <limits.h>
461 #include <string.h>
462 #include "tinycv_c.h"
463 ${aux_func}
464 void ${kernel_sig}{
465 uint8_t * sptr = src->data;
466 uint8_t * dptr = dst->data;
467 size_t rows = src->rows;
468 size_t cols = src->cols;
469 size_t hw = rows * cols;
470 size_t ch = src->channels;
471
472 ${cvt_code}
473
474 }
475 )";
476
477 return StringTemplate::StringTemplateArgs()
478 .add("aux_func", code.aux_func)
479 .add("cvt_code", code.cvt_code)
480 .add("kernel_sig", kernel_sig)
481 .render(body_temp);
482}
483
484// 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