#ifdef IDS_FAWN ,{"color", color} ,{"sem", sem} #endif }); } response = Json::object{ {"time", resp.time}, {"load_time", resp.load_time}, {"filter_time", resp.filter_time}, {"rank_time", resp.rank_time}, {"hits", hits}}; }); add_json_api("/search_batch", "POST", [this](Json &response, Json &request) { SearchRequest req; LOAD_PARAM(request, req, db, int_value, 0); LOAD_PARAM(request, req, raw, bool_value, true); /* LOAD_PARAM(request, req, url, string_value, ""); LOAD_PARAM(request, req, content, string_value, ""); */ LOAD_PARAM(request, req, type, string_value, ""); LOAD_PARAM(request, req, K, int_value, -1); LOAD_PARAM(request, req, R, number_value, NAN); LOAD_PARAM(request, req, hint_K, int_value, -1); LOAD_PARAM(request, req, hint_R, number_value, NAN); string params_l1; LOAD_PARAM1(request, params_l1, params_l1, string_value, ""); req.params_l1.decode(params_l1); Json::array results;
mlib_status __mlib_ImageZoomTranslateTableBlend( mlib_image *dst, const mlib_image *src, mlib_d64 zoomx, mlib_d64 zoomy, mlib_d64 tx, mlib_d64 ty, const void *table, mlib_edge edge, mlib_blend blend, mlib_s32 cmask) { mlib_affine_param param[1]; mlib_affine_param *cur_param; mlib_zoom_workspace ws[1]; mlib_d64 buff_lcl[BUFF_SIZE / 8]; mlib_type type; mlib_u8 *srcData, *dstData; mlib_s32 srcWidth, dstWidth, srcHeight, dstHeight; mlib_s32 srcStride, dstStride, schan, dchan; mlib_s32 *leftEdges, *rightEdges, *xStarts, *yStarts; mlib_s32 *p_x_ind = NULL, *x_ind, *x_tab = NULL, xpos; mlib_u8 **lineAddr = NULL; mlib_s32 kw, kh, kw1, kh1; mlib_status res = MLIB_SUCCESS; fun_type_nw fun_nw = NULL; mlib_interp_table *tbl = (mlib_interp_table *) table; mlib_d64 mtx[6], dxs, tmp_dxs, div; mlib_s32 i, x_shift, y_shift; mlib_s32 affine = 0, yStart; mlib_s32 xLeft_e, xRight_e, xLeft, xRight, dx; mtx[0] = zoomx; mtx[1] = 0; mtx[2] = tx; mtx[3] = 0; mtx[4] = zoomy; mtx[5] = ty; ws->zoomx = zoomx; ws->zoomy = zoomy; /* check for obvious errors */ MLIB_IMAGE_CHECK(src); MLIB_IMAGE_CHECK(dst); MLIB_IMAGE_TYPE_EQUAL(src, dst); MLIB_IMAGE_HAVE_TYPE(src, MLIB_BYTE); if (zoomx <= 0 || zoomy <= 0) return (MLIB_OUTOFRANGE); if (mlib_ImageGetWidth(src) >= (1 << 15) || mlib_ImageGetHeight(src) >= (1 << 15)) { return (MLIB_FAILURE); } MLIB_IMAGE_GET_ALL_PARAMS(src, type, schan, srcWidth, srcHeight, srcStride, srcData); MLIB_IMAGE_GET_ALL_PARAMS(dst, type, dchan, dstWidth, dstHeight, dstStride, dstData); if ((schan == 4 || dchan == 4) && cmask != 1 && cmask != 8) return (MLIB_OUTOFRANGE); if (schan < 3 || schan > 4 || dchan < 3 || dchan > 4) { return (MLIB_FAILURE); } if ((blend == MLIB_BLEND_GTK_SRC) && (schan == 3) && (dchan == 3)) return __mlib_ImageZoomTranslateTable(dst, src, zoomx, zoomy, tx, ty, table, edge); kw = tbl->width; kh = tbl->height; kw1 = tbl->leftPadding; kh1 = tbl->topPadding; x_shift = INT_BITS - mlib_ilogb(srcWidth + kw); y_shift = INT_BITS - mlib_ilogb(srcHeight + kh); ws->type = type; ws->srcData = srcData; ws->dstData = dstData; ws->srcWidth = srcWidth; ws->srcHeight = srcHeight; ws->srcStride = srcStride; ws->dstStride = dstStride; ws->nchan = schan; ws->dchan = dchan; ws->blend = blend; ws->alpha_shift = 1; ws->edge = edge; ws->x_shift = x_shift; ws->y_shift = y_shift; ws->x_move = (kw1 << x_shift); ws->y_move = (kh1 << y_shift); if (cmask == 1) ws->alpha_shift = -3; /* VIS version of non NULL */ fun_nw = mlib_ImageZoomTranslate_GetFunc(ws, table); if (fun_nw == NULL) { fun_nw = mlib_ImageZoomTranslateTableBlend_8nw; } /* NULL */ STORE_PARAM(param, affine); STORE_PARAM(param, lineAddr); param->buff_malloc = NULL; /* process internal pixels */ res = mlib_AffineEdges(param, dst, src, buff_lcl, BUFF_SIZE, kw, kh, kw1, kh1, edge, mtx, x_shift, y_shift); if (res != MLIB_SUCCESS) return (res); ws->yStart = param->yStart; ws->yFinish = param->yFinish; ws->max_xsize = param->max_xsize; ws->dx = param->dX; ws->dy = param->dY; LOAD_PARAM(param, lineAddr); LOAD_PARAM(param, leftEdges); LOAD_PARAM(param, rightEdges); LOAD_PARAM(param, xStarts); LOAD_PARAM(param, yStarts); if (edge == MLIB_EDGE_SRC_EXTEND) ws->y_move += (1 << (y_shift - 1)); if ((ws->max_xsize) > 0) { /* RTC */ yStarts[(ws->yFinish) + 1] = 0; res = fun_nw(param->dstData, lineAddr, leftEdges, rightEdges, xStarts, yStarts, ws, tbl); if (res != MLIB_SUCCESS) { if (param->buff_malloc != NULL) __mlib_free(param->buff_malloc); return (res); } } /* process edge pixels */ if (edge != MLIB_EDGE_DST_NO_WRITE && edge != MLIB_EDGE_SRC_PADDED) { mlib_affine_param param_e[1]; param_e->buff_malloc = NULL; if (edge == MLIB_EDGE_DST_FILL_ZERO || edge == MLIB_EDGE_OP_NEAREST) { x_shift = 16; y_shift = 16; } STORE_PARAM(param_e, lineAddr); if (edge != MLIB_EDGE_SRC_EXTEND_INDEF) { res = mlib_AffineEdges(param_e, dst, src, NULL, 0, kw, kh, kw1, kh1, -1, mtx, x_shift, y_shift); } if (res == MLIB_SUCCESS) switch (edge) { case MLIB_EDGE_DST_FILL_ZERO: mlib_ImageZoomTranslateTableBlendEdgeZero (param, param_e, dchan, schan, ws->alpha_shift, blend); break; case MLIB_EDGE_OP_NEAREST: mlib_ImageZoomTranslateTableBlendEdgeNearest (param, param_e, dchan, schan, ws->alpha_shift, blend); break; case MLIB_EDGE_SRC_EXTEND: case MLIB_EDGE_SRC_EXTEND_INDEF: ws->x_shift = x_shift; ws->x_move += (1 << (x_shift - 1)); if (edge == MLIB_EDGE_SRC_EXTEND) { ws->yStart = param_e->yStart; ws->yFinish = param_e->yFinish; yStart = ws->yStart; ws->dx = param_e->dX; xLeft_e = param_e->leftEdges[yStart]; xRight_e = param_e->rightEdges[yStart]; cur_param = param_e; } else { cur_param = param; ws->yStart = param->yStart; yStart = ws->yStart; xLeft_e = 0; xRight_e = dstWidth - 1; } xLeft = param->leftEdges[param->yStart]; xRight = param->rightEdges[param->yStart]; if ((xLeft > xRight) || (param->yStart > param->yFinish)) { xLeft = xRight_e + 1; xRight = xRight_e; } if (((xRight_e - xLeft_e + 1) > 0) && (ws->yStart <= ws->yFinish)) { CREATE_X_IND(); LOAD_PARAM(cur_param, lineAddr); LOAD_PARAM(cur_param, leftEdges); LOAD_PARAM(cur_param, xStarts); LOAD_PARAM(cur_param, yStarts); /* RTC */ yStarts[(ws->yFinish) + 1] = 0; if (edge == MLIB_EDGE_SRC_EXTEND) { CREATE_X_EXT() } ws->max_xsize = xLeft - xLeft_e; if ((ws->max_xsize) > 0) { if (edge != MLIB_EDGE_SRC_EXTEND) { CREATE_X(xLeft_e, xLeft - 1); } leftEdges[0] = ws->max_xsize; leftEdges[1] = xLeft_e; res = FUNCNAME_EXT (cur_param->dstData, lineAddr, x_ind, leftEdges, x_tab, xStarts, yStarts, ws, tbl); } ws->max_xsize = xRight_e - xRight; if ((ws->max_xsize) > 0) { mlib_s32 shift = 0; if (edge != MLIB_EDGE_SRC_EXTEND) { CREATE_X(xRight + 1, xRight_e); } else { shift = xRight + 1 - xLeft_e; } leftEdges[0] = ws->max_xsize; leftEdges[1] = xRight + 1; res = FUNCNAME_EXT (cur_param->dstData, lineAddr, x_ind, leftEdges, x_tab + shift, xStarts, yStarts, ws, tbl); } __mlib_free(p_x_ind); if (x_tab != NULL) __mlib_free(x_tab); } break; default: res = MLIB_FAILURE; break; }