summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWenbin Chen <wenbin.chen@intel.com>2024-04-02 16:13:06 +0800
committerGuo Yejun <yejun.guo@intel.com>2024-04-04 14:26:57 +0800
commit478d97f3034fd7c0e1d8a1068b649e8fcc16f82f (patch)
treebd855deaba47fdb6b417c1de4e61d2ecf419b7b8
parent8869f5ce864f197f3192c1660124e64da3f26989 (diff)
libavfilter/dnn_io_proc: Take step into consideration when crop frame
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Reviewed-by: Guo Yejun <yejun.guo@intel.com>
-rw-r--r--libavfilter/dnn/dnn_io_proc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c
index f3a605f73c..826110dab0 100644
--- a/libavfilter/dnn/dnn_io_proc.c
+++ b/libavfilter/dnn/dnn_io_proc.c
@@ -351,6 +351,7 @@ int ff_frame_to_dnn_classify(AVFrame *frame, DNNData *input, uint32_t bbox_index
const AVDetectionBBoxHeader *header;
const AVDetectionBBox *bbox;
AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DETECTION_BBOXES);
+ int max_step[4] = { 0 };
av_assert0(sd);
/* (scale != 1 and scale != 0) or mean != 0 */
@@ -406,8 +407,9 @@ int ff_frame_to_dnn_classify(AVFrame *frame, DNNData *input, uint32_t bbox_index
offsety[1] = offsety[2] = AV_CEIL_RSHIFT(top, desc->log2_chroma_h);
offsety[0] = offsety[3] = top;
+ av_image_fill_max_pixsteps(max_step, NULL, desc);
for (int k = 0; frame->data[k]; k++)
- bbox_data[k] = frame->data[k] + offsety[k] * frame->linesize[k] + offsetx[k];
+ bbox_data[k] = frame->data[k] + offsety[k] * frame->linesize[k] + offsetx[k] * max_step[k];
sws_scale(sws_ctx, (const uint8_t *const *)&bbox_data, frame->linesize,
0, height,