diff mbox series

[FFmpeg-devel,3/3] avfilter/find_rect: write score to metadata

Message ID 20210401131832.9614-3-ffmpeg@gyani.pro
State Accepted
Commit 18dcbb0d6ce7434a76f8ebea40739e8eb5b14b78
Headers show
Series [FFmpeg-devel,1/3] avfilter/find_rect: improve logging
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Gyan Doshi April 1, 2021, 1:18 p.m. UTC
---
 libavfilter/vf_find_rect.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Gyan Doshi April 3, 2021, 4:14 p.m. UTC | #1
Plan to push set tomorrow.

On 2021-04-01 18:48, Gyan Doshi wrote:
> ---
>   libavfilter/vf_find_rect.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c
> index f9129cc140..b6f5a1be29 100644
> --- a/libavfilter/vf_find_rect.c
> +++ b/libavfilter/vf_find_rect.c
> @@ -187,6 +187,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
>       float best_score;
>       int best_x, best_y;
>       int i;
> +    char buf[32];
>   
>       foc->haystack_frame[0] = av_frame_clone(in);
>       for (i=1; i<foc->mipmaps; i++) {
> @@ -222,12 +223,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
>       foc->last_x = best_x;
>       foc->last_y = best_y;
>   
> +    snprintf(buf, sizeof(buf), "%f", best_score);
> +
>       av_frame_make_writable(in);
>   
>       av_dict_set_int(&in->metadata, "lavfi.rect.w", foc->obj_frame->width, 0);
>       av_dict_set_int(&in->metadata, "lavfi.rect.h", foc->obj_frame->height, 0);
>       av_dict_set_int(&in->metadata, "lavfi.rect.x", best_x, 0);
>       av_dict_set_int(&in->metadata, "lavfi.rect.y", best_y, 0);
> +    av_dict_set(&in->metadata, "lavfi.rect.score", buf, 0);
>   
>       return ff_filter_frame(ctx->outputs[0], in);
>   }
Gyan Doshi April 4, 2021, 5:20 a.m. UTC | #2
On 2021-04-03 21:44, Gyan Doshi wrote:
> Plan to push set tomorrow.

Pushed as

aff23c3474f93d7f08422755a55da4ba3ce1e800
abdafca9ad26b020b13b76d538a98d135d127fcb
18dcbb0d6ce7434a76f8ebea40739e8eb5b14b78

Gyan


>
> On 2021-04-01 18:48, Gyan Doshi wrote:
>> ---
>>   libavfilter/vf_find_rect.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c
>> index f9129cc140..b6f5a1be29 100644
>> --- a/libavfilter/vf_find_rect.c
>> +++ b/libavfilter/vf_find_rect.c
>> @@ -187,6 +187,7 @@ static int filter_frame(AVFilterLink *inlink, 
>> AVFrame *in)
>>       float best_score;
>>       int best_x, best_y;
>>       int i;
>> +    char buf[32];
>>         foc->haystack_frame[0] = av_frame_clone(in);
>>       for (i=1; i<foc->mipmaps; i++) {
>> @@ -222,12 +223,15 @@ static int filter_frame(AVFilterLink *inlink, 
>> AVFrame *in)
>>       foc->last_x = best_x;
>>       foc->last_y = best_y;
>>   +    snprintf(buf, sizeof(buf), "%f", best_score);
>> +
>>       av_frame_make_writable(in);
>>         av_dict_set_int(&in->metadata, "lavfi.rect.w", 
>> foc->obj_frame->width, 0);
>>       av_dict_set_int(&in->metadata, "lavfi.rect.h", 
>> foc->obj_frame->height, 0);
>>       av_dict_set_int(&in->metadata, "lavfi.rect.x", best_x, 0);
>>       av_dict_set_int(&in->metadata, "lavfi.rect.y", best_y, 0);
>> +    av_dict_set(&in->metadata, "lavfi.rect.score", buf, 0);
>>         return ff_filter_frame(ctx->outputs[0], in);
>>   }
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c
index f9129cc140..b6f5a1be29 100644
--- a/libavfilter/vf_find_rect.c
+++ b/libavfilter/vf_find_rect.c
@@ -187,6 +187,7 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     float best_score;
     int best_x, best_y;
     int i;
+    char buf[32];
 
     foc->haystack_frame[0] = av_frame_clone(in);
     for (i=1; i<foc->mipmaps; i++) {
@@ -222,12 +223,15 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     foc->last_x = best_x;
     foc->last_y = best_y;
 
+    snprintf(buf, sizeof(buf), "%f", best_score);
+
     av_frame_make_writable(in);
 
     av_dict_set_int(&in->metadata, "lavfi.rect.w", foc->obj_frame->width, 0);
     av_dict_set_int(&in->metadata, "lavfi.rect.h", foc->obj_frame->height, 0);
     av_dict_set_int(&in->metadata, "lavfi.rect.x", best_x, 0);
     av_dict_set_int(&in->metadata, "lavfi.rect.y", best_y, 0);
+    av_dict_set(&in->metadata, "lavfi.rect.score", buf, 0);
 
     return ff_filter_frame(ctx->outputs[0], in);
 }