Re: [FFmpeg-devel] [PATCH]lavfi/hflip: Support Bayer pixel formats

2020-08-24 Thread Carl Eugen Hoyos
Am So., 26. Juli 2020 um 21:59 Uhr schrieb Carl Eugen Hoyos
:
>
> Am So., 26. Juli 2020 um 21:28 Uhr schrieb Paul B Mahol :
> >
> > On 7/26/20, Carl Eugen Hoyos  wrote:
> > > Hi!
> > >
> > > Attached patch fixes a part of ticket #8819.
> > >
> > > Please comment, Carl Eugen
> > >
> >
> > Looks good, but variable name is unfortunate.
>
> New patch attached.

Patch applied.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH]lavfi/hflip: Support Bayer pixel formats

2020-07-27 Thread Reto Kromer
Carl Eugen Hoyos wrote:

>Am So., 26. Juli 2020 um 21:28 Uhr schrieb Paul B Mahol
>:
>>
>> On 7/26/20, Carl Eugen Hoyos  wrote:
>> > Hi!
>> >
>> > Attached patch fixes a part of ticket #8819.
>> >
>> > Please comment, Carl Eugen
>> >
>>
>> Looks good, but variable name is unfortunate.
>
>New patch attached.

I am afraid, I still experience the same behaviour:

- the original image (*) has an yellow tinting
- hflip,vflip together gives the correct image texture but with
  a blue tinting
- hflip and vplip individually give a light magenta colour and a
  pattern which I consider to be a Bayer phase error

Thank you and best regards, Reto


* the clip is number 3 at https://avpres.net/CineForm/ (I could
not upload at ticket #8819 because it's 22.3 MB)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH]lavfi/hflip: Support Bayer pixel formats

2020-07-26 Thread Carl Eugen Hoyos
Am So., 26. Juli 2020 um 21:28 Uhr schrieb Paul B Mahol :
>
> On 7/26/20, Carl Eugen Hoyos  wrote:
> > Hi!
> >
> > Attached patch fixes a part of ticket #8819.
> >
> > Please comment, Carl Eugen
> >
>
> Looks good, but variable name is unfortunate.

New patch attached.

Carl Eugen
From 43ece0f9b13f4b7fe2d1c96f289ba70ae9a4211d Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Sun, 26 Jul 2020 21:58:31 +0200
Subject: [PATCH] lavfi/hflip: Support Bayer pixel formats.

Fixes part of ticket #8819.
---
 libavfilter/hflip.h   | 1 +
 libavfilter/vf_hflip.c| 4 +++-
 tests/checkasm/vf_hflip.c | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavfilter/hflip.h b/libavfilter/hflip.h
index 204090dbb4..a40b98470b 100644
--- a/libavfilter/hflip.h
+++ b/libavfilter/hflip.h
@@ -27,6 +27,7 @@
 typedef struct FlipContext {
 const AVClass *class;
 int max_step[4];///< max pixel step for each plane, expressed as a number of bytes
+int bayer_plus1;///< 1 .. not a Bayer input format, 2 .. Bayer input format
 int planewidth[4];  ///< width of each plane
 int planeheight[4]; ///< height of each plane
 
diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index b77afc77fc..d1ec52fc82 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -138,6 +138,7 @@ static int config_props(AVFilterLink *inlink)
 s->planewidth[1]  = s->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, hsub);
 s->planeheight[0] = s->planeheight[3] = inlink->h;
 s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
+s->bayer_plus1 = !!(pix_desc->flags & AV_PIX_FMT_FLAG_BAYER) + 1;
 
 nb_planes = av_pix_fmt_count_planes(inlink->format);
 
@@ -149,6 +150,7 @@ int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
 int i;
 
 for (i = 0; i < nb_planes; i++) {
+step[i] *= s->bayer_plus1;
 switch (step[i]) {
 case 1: s->flip_line[i] = hflip_byte_c;  break;
 case 2: s->flip_line[i] = hflip_short_c; break;
@@ -180,7 +182,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
 int i, plane, step;
 
 for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) {
-const int width  = s->planewidth[plane];
+const int width  = s->planewidth[plane] / s->bayer_plus1;
 const int height = s->planeheight[plane];
 const int start = (height *  job   ) / nb_jobs;
 const int end   = (height * (job+1)) / nb_jobs;
diff --git a/tests/checkasm/vf_hflip.c b/tests/checkasm/vf_hflip.c
index 6bb4d09d64..48ebf85fdb 100644
--- a/tests/checkasm/vf_hflip.c
+++ b/tests/checkasm/vf_hflip.c
@@ -40,6 +40,7 @@ static void check_hflip(int step, const char * report_name){
 int i;
 int step_array[4] = {1, 1, 1, 1};
 FlipContext s;
+s.bayer_plus1 = 1;
 
 declare_func(void, const uint8_t *src, uint8_t *dst, int w);
 
-- 
2.24.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH]lavfi/hflip: Support Bayer pixel formats

2020-07-26 Thread Paul B Mahol
On 7/26/20, Carl Eugen Hoyos  wrote:
> Hi!
>
> Attached patch fixes a part of ticket #8819.
>
> Please comment, Carl Eugen
>

Looks good, but variable name is unfortunate.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH]lavfi/hflip: Support Bayer pixel formats

2020-07-26 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes a part of ticket #8819.

Please comment, Carl Eugen
From 21aff2c2b8f3c5760589a99768d483b4be216bcd Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Sun, 26 Jul 2020 21:15:48 +0200
Subject: [PATCH] lavfi/hflip: Support Bayer pixel formats.

Fixes part of ticket #8819.
---
 libavfilter/hflip.h| 1 +
 libavfilter/vf_hflip.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/hflip.h b/libavfilter/hflip.h
index 204090dbb4..32356cde34 100644
--- a/libavfilter/hflip.h
+++ b/libavfilter/hflip.h
@@ -27,6 +27,7 @@
 typedef struct FlipContext {
 const AVClass *class;
 int max_step[4];///< max pixel step for each plane, expressed as a number of bytes
+int bayer;  ///< 1 .. not a Bayer input format, 2 .. Bayer input format
 int planewidth[4];  ///< width of each plane
 int planeheight[4]; ///< height of each plane
 
diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index b77afc77fc..77db218bda 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -138,6 +138,7 @@ static int config_props(AVFilterLink *inlink)
 s->planewidth[1]  = s->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, hsub);
 s->planeheight[0] = s->planeheight[3] = inlink->h;
 s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
+s->bayer = !!(pix_desc->flags & AV_PIX_FMT_FLAG_BAYER) + 1;
 
 nb_planes = av_pix_fmt_count_planes(inlink->format);
 
@@ -149,6 +150,7 @@ int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
 int i;
 
 for (i = 0; i < nb_planes; i++) {
+step[i] *= s->bayer;
 switch (step[i]) {
 case 1: s->flip_line[i] = hflip_byte_c;  break;
 case 2: s->flip_line[i] = hflip_short_c; break;
@@ -180,7 +182,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
 int i, plane, step;
 
 for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) {
-const int width  = s->planewidth[plane];
+const int width  = s->planewidth[plane] / s->bayer;
 const int height = s->planeheight[plane];
 const int start = (height *  job   ) / nb_jobs;
 const int end   = (height * (job+1)) / nb_jobs;
-- 
2.24.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".