1 /* 2 * Copyright 2020 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "iep2_roi.h" 18 19 #include <stdio.h> 20 #include <string.h> 21 #include <stdlib.h> 22 23 #include "iep2_api.h" 24 iep2_set_roi(struct iep2_api_ctx * ctx,struct iep2_rect * r,enum ROI_MODE mode)25void iep2_set_roi(struct iep2_api_ctx *ctx, struct iep2_rect *r, 26 enum ROI_MODE mode) 27 { 28 int idx = ctx->params.roi_layer_num; 29 30 ctx->params.roi_en = 1; 31 32 ctx->params.xsta[idx] = r->x; 33 ctx->params.ysta[idx] = r->y; 34 ctx->params.xend[idx] = r->x + r->w - 1; 35 ctx->params.yend[idx] = r->y + r->h - 1; 36 ctx->params.roi_mode[idx] = mode; 37 38 ctx->params.roi_layer_num++; 39 } 40