diff --git a/src/main.cpp b/src/main.cpp index 115bd47..29a6af6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1357,108 +1357,6 @@ int moebius(lua_State* L) Mat out; cv::resize(tmp, out, Size(width, height), 0, 0, INTER_LANCZOS4); PutPixelData(L, out.data); - - /* - Mat out; - bool wh_flag = (ow < oh); - bool w_flag = ((ow - 8) < new_buf.cols); - bool h_flag = (oh < new_buf.rows); - bool b_flag = (new_buf.rows < new_buf.cols); - double cn = 0.0; - - if (w_flag || h_flag) - { - if (!h_flag) - { - cn = double(ow - 8) / new_w; - } - else if (!w_flag) - { - cn = (double)oh / new_h; - } - else - { - if (b_flag) - { - cn = (double)oh / new_h; - } - else - { - cn = double(ow - 8) / new_w; - } - } - std::cout << cn << std::endl; - cv::resize(new_buf, out, Size(), cn, cn, INTER_LANCZOS4); - } - - assert((out.cols <= (ow - 8)) && (out.rows <= oh)); - - cv::namedWindow("result", WINDOW_NORMAL); - cv::imshow("result", out); - */ - - /* - parallel_for(0, out.rows, 1, [&](int y) - { - auto pOUT = out.ptr(y); - - for (auto x = 0; x < out.cols; ++x) - { - int idx = x + y * out.cols; - int r = static_cast(pOUT[idx][2]); - int g = static_cast(pOUT[idx][1]); - int b = static_cast(pOUT[idx][0]); - int a = static_cast(pOUT[idx][3]); - - int r_ = (r << 6) + 18; - int g_ = (g << 6) + 18; - int b_ = (b << 6) + 18; - int a_ = (a << 6) + 1; - - (*dt + idx)->y = static_cast(((r_ * 4918) >> 16) + ((g_ * 9655) >> 16) + ((b_ * 1875) >> 16) - 3); - (*dt + idx)->cb = static_cast(((r_ * -2775) >> 16) + ((g_ * -5449) >> 16) + ((b_ * 8224) >> 16) + 1); - (*dt + idx)->cr = static_cast(((r_ * 8224) >> 16) + ((g_ * -6887) >> 16) + ((b_ * -1337) >> 16) + 1); - (*dt + idx)->a = static_cast((a_ * 16448) >> 16); - } - } - ); - */ - - /* - parallel_for(0, ht, 1, [&](int y) - { - for (auto x = 0; x < wt; ++x) - { - int cdi = x + y * wt; - double xrange = (xmax == xmin) ? 1 : (xmax - xmin); - double yrange = (ymax == ymin) ? 1 : (ymax - ymin); - int new_x = int((wt - 1) * (coodX[cdi] - xmin) / xrange); - int new_y = int((ht - 1) * (coodY[cdi] - ymin) / yrange); - - new_x = constrain(new_x, 0, wt - 1); - new_y = constrain(new_y, 0, ht - 1); - - auto pOUT = buf_bgra.ptr(new_y); - - int idx = x + y * ow; - int r = static_cast(pOUT[new_x][2]); - int g = static_cast(pOUT[new_x][1]); - int b = static_cast(pOUT[new_x][0]); - int a = static_cast(pOUT[new_x][3]); - - int r_ = (r << 6) + 18; - int g_ = (g << 6) + 18; - int b_ = (b << 6) + 18; - int a_ = (a << 6) + 1; - - (*dt + idx)->y = static_cast(((r_ * 4918) >> 16) + ((g_ * 9655) >> 16) + ((b_ * 1875) >> 16) - 3); - (*dt + idx)->cb = static_cast(((r_ * -2775) >> 16) + ((g_ * -5449) >> 16) + ((b_ * 8224) >> 16) + 1); - (*dt + idx)->cr = static_cast(((r_ * 8224) >> 16) + ((g_ * -6887) >> 16) + ((b_ * -1337) >> 16) + 1); - (*dt + idx)->a = static_cast((a_ * 16448) >> 16); - } - } - ); - */ } catch (const std::exception& ex) {