Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-22 Thread Andy Furniss

Nayan Deshmukh wrote:

Hi Andy,



On Wed, Sep 21, 2016 at 9:30 PM, Andy Furniss  wrote:


Andy Furniss wrote:


Andy Furniss wrote:


Andy Furniss wrote:


Andy Furniss wrote:

bz2 compressed vid showing the issue -


https://drive.google.com/open?id=0BxP5-S1t9VEEUE5sbUFBV20zSms



To be clear this is just the test rez vid I used so you can
possibly recreate the issue your self.



Hmm, interesting, with bicubic, hqscaling=1 this vid behaves
differently with mplayer compared to mpv, the latter looks like
it's scaling a bit, maybe there's an off by one somewhere in mpv
code.



I don't know if it's the cause, but looking for differences between
mplayer and mpv it seems that mpv sets video mixer height so it's
divisible by 32 but mplayer doesn't. For this 720p sample it uses 736
and mplayer uses 720.

vdp_video_mixer_create(1, 1, {11}, 3, {0, 1, 2}, {1280, 736, 0}, -)

for output surfaces and render calls it uses 720.

So does the bicubic code see/use this 736 somewhere?



To answer my own question - it does.

Putting a printf in vl_bicubic.c create_frag_shader video_height = 736

We intialize the filters with height of video mixer, So that explains the

difference.


Yea, is there a way around it though? I assume what mpv does is legal.


I was not able to make any progress with offsets nor the artifacts. Can you
try
testing the lanczos filter by removing this line form create_frag_shader :-

ureg_SUB(shader, ureg_writemask(t_array[1], TGSI_WRITEMASK_XY),
 ureg_src(t_array[1]), half_pixel);


This causes a shift in the opposite direction.

Maybe offset is the wrong way to describe it as there are no lost
pixels at the edges - they are just blended a bit and the whole image
appears to move slightly when overlaid with one made with other scaling
methods. Up and left with the above removed, down and right with above
in place. This happens even on an un-scaled image but is more obvious on
one scaled up. IIRC bicubic used to do this at one stage but doesn't now
at all for un-scaled, maybe a tiny bit for scaled up.

The above change makes no difference to artifacts. I also managed to
get 2 to artifact and of course 2 and 4 still have white line artifacts
sometimes, which I thought may be to do with the offset - but they are
still there (same place) with the above removed, so I guess not.

There is still the issue with all levels eating the 1:1 pix detail on
the vertrez720 vid I uploaded when unscaled.


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-22 Thread Andy Furniss

Christian König wrote:

Am 21.09.2016 um 16:38 schrieb Andy Furniss:

Andy Furniss wrote:

Andy Furniss wrote:

Andy Furniss wrote:


bz2 compressed vid showing the issue -

https://drive.google.com/open?id=0BxP5-S1t9VEEUE5sbUFBV20zSms


To be clear this is just the test rez vid I used so you can
possibly recreate the issue your self.


Hmm, interesting, with bicubic, hqscaling=1 this vid behaves
differently with mplayer compared to mpv, the latter looks like
it's scaling a bit, maybe there's an off by one somewhere in mpv
code.


I don't know if it's the cause, but looking for differences between
mplayer and mpv it seems that mpv sets video mixer height so it's
divisible by 32 but mplayer doesn't. For this 720p sample it uses 736
and mplayer uses 720.

vdp_video_mixer_create(1, 1, {11}, 3, {0, 1, 2}, {1280, 736, 0}, -)

for output surfaces and render calls it uses 720.

So does the bicubic code see/use this 736 somewhere?


Well that would clearly explain some differences. Are the video input
buffers rounded up to 32 as well?


It would seem so VDPAU_TRACE=1 shows mpv asks for (with lots snipped) -

vdp_output_surface_create(1, 0, 1280, 720, -)

vdp_video_surface_create(1, 0, 1280, 720, -)

then later does

vdp_video_surface_get_parameters(9, -, -, -)
-> 0, 0, 1280, 736

and next creates the mixer -

vdp_video_mixer_create(1, 0, {}, 3, {0, 1, 2}, {1280, 736, 0}, -)
-> 0, 10


vdp_video_mixer_set_attribute_values(10, 1, {1}, {{{1.164384, 0.00, 
1.792741, -0.972945}, {1.164384, -0.213249, -0.532909, 0.301483}, 
{1.164384, 2.112402, 0.00, -1.133402}}})

-> 0
vdp_video_mixer_render(10, 4294967295, NULL, 2, 2, {4294967295, 
4294967295}, 9, 2, {4294967295, 4294967295}, {0, 0, 1280, 720}, 6, NULL, 
{0, 0, 1280, 720}, 0, NULL)




If not then mpv is clearly not using the interface correctly here:

#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT

The exact height of input video surfaces.


Hmm, so maybe it is right?

Seems it's not mpv that rounds up the surface size.



This parameter's type is uint32_t.

This parameter defaults to 0 if not specified, which entails that it
must be specified.

The application may query this parameter's supported range.

#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH

The exact width of input video surfaces.

This parameter's type is uint32_t.

This parameter defaults to 0 if not specified, which entails that it
must be specified.

The application may query this parameter's supported range.



Maybe we should make the checks done during rending more strict?

Regards,
Christian.



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev






___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-22 Thread Christian König

Am 21.09.2016 um 16:38 schrieb Andy Furniss:

Andy Furniss wrote:

Andy Furniss wrote:

Andy Furniss wrote:


bz2 compressed vid showing the issue -

https://drive.google.com/open?id=0BxP5-S1t9VEEUE5sbUFBV20zSms


To be clear this is just the test rez vid I used so you can
possibly recreate the issue your self.


Hmm, interesting, with bicubic, hqscaling=1 this vid behaves
differently with mplayer compared to mpv, the latter looks like
it's scaling a bit, maybe there's an off by one somewhere in mpv
code.


I don't know if it's the cause, but looking for differences between
mplayer and mpv it seems that mpv sets video mixer height so it's
divisible by 32 but mplayer doesn't. For this 720p sample it uses 736
and mplayer uses 720.

vdp_video_mixer_create(1, 1, {11}, 3, {0, 1, 2}, {1280, 736, 0}, -)

for output surfaces and render calls it uses 720.

So does the bicubic code see/use this 736 somewhere?


Well that would clearly explain some differences. Are the video input 
buffers rounded up to 32 as well?


If not then mpv is clearly not using the interface correctly here:

#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT

The exact height of input video surfaces.

This parameter's type is uint32_t.

This parameter defaults to 0 if not specified, which entails that it 
must be specified.


The application may query this parameter's supported range.

#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH

The exact width of input video surfaces.

This parameter's type is uint32_t.

This parameter defaults to 0 if not specified, which entails that it 
must be specified.


The application may query this parameter's supported range.



Maybe we should make the checks done during rending more strict?

Regards,
Christian.



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-21 Thread Nayan Deshmukh
Hi Andy,



On Wed, Sep 21, 2016 at 9:30 PM, Andy Furniss  wrote:

> Andy Furniss wrote:
>
>> Andy Furniss wrote:
>>
>>> Andy Furniss wrote:
>>>
 Andy Furniss wrote:

 bz2 compressed vid showing the issue -
>
> https://drive.google.com/open?id=0BxP5-S1t9VEEUE5sbUFBV20zSms
>

 To be clear this is just the test rez vid I used so you can
 possibly recreate the issue your self.

>>>
>>> Hmm, interesting, with bicubic, hqscaling=1 this vid behaves
>>> differently with mplayer compared to mpv, the latter looks like
>>> it's scaling a bit, maybe there's an off by one somewhere in mpv
>>> code.
>>>
>>
>> I don't know if it's the cause, but looking for differences between
>> mplayer and mpv it seems that mpv sets video mixer height so it's
>> divisible by 32 but mplayer doesn't. For this 720p sample it uses 736
>> and mplayer uses 720.
>>
>> vdp_video_mixer_create(1, 1, {11}, 3, {0, 1, 2}, {1280, 736, 0}, -)
>>
>> for output surfaces and render calls it uses 720.
>>
>> So does the bicubic code see/use this 736 somewhere?
>>
>
> To answer my own question - it does.
>
> Putting a printf in vl_bicubic.c create_frag_shader video_height = 736
>
> We intialize the filters with height of video mixer, So that explains the
difference.

I was not able to make any progress with offsets nor the artifacts. Can you
try
testing the lanczos filter by removing this line form create_frag_shader :-

ureg_SUB(shader, ureg_writemask(t_array[1], TGSI_WRITEMASK_XY),
ureg_src(t_array[1]), half_pixel);

I am not able to replicate the offset issue in my system, though the
artifacts
issue is reproducible for all levels except 2 and 4

Regards,
Nayan.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-21 Thread Andy Furniss

Andy Furniss wrote:

Andy Furniss wrote:

Andy Furniss wrote:

Andy Furniss wrote:


bz2 compressed vid showing the issue -

https://drive.google.com/open?id=0BxP5-S1t9VEEUE5sbUFBV20zSms


To be clear this is just the test rez vid I used so you can
possibly recreate the issue your self.


Hmm, interesting, with bicubic, hqscaling=1 this vid behaves
differently with mplayer compared to mpv, the latter looks like
it's scaling a bit, maybe there's an off by one somewhere in mpv
code.


I don't know if it's the cause, but looking for differences between
mplayer and mpv it seems that mpv sets video mixer height so it's
divisible by 32 but mplayer doesn't. For this 720p sample it uses 736
and mplayer uses 720.

vdp_video_mixer_create(1, 1, {11}, 3, {0, 1, 2}, {1280, 736, 0}, -)

for output surfaces and render calls it uses 720.

So does the bicubic code see/use this 736 somewhere?


To answer my own question - it does.

Putting a printf in vl_bicubic.c create_frag_shader video_height = 736








___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-21 Thread Andy Furniss

Andy Furniss wrote:

Andy Furniss wrote:

Andy Furniss wrote:


bz2 compressed vid showing the issue -

https://drive.google.com/open?id=0BxP5-S1t9VEEUE5sbUFBV20zSms


To be clear this is just the test rez vid I used so you can
possibly recreate the issue your self.


Hmm, interesting, with bicubic, hqscaling=1 this vid behaves
differently with mplayer compared to mpv, the latter looks like
it's scaling a bit, maybe there's an off by one somewhere in mpv
code.


I don't know if it's the cause, but looking for differences between
mplayer and mpv it seems that mpv sets video mixer height so it's
divisible by 32 but mplayer doesn't. For this 720p sample it uses 736
and mplayer uses 720.

vdp_video_mixer_create(1, 1, {11}, 3, {0, 1, 2}, {1280, 736, 0}, -)

for output surfaces and render calls it uses 720.

So does the bicubic code see/use this 736 somewhere?

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-19 Thread Nayan Deshmukh
Hi Andy,



On Mon, Sep 19, 2016 at 3:27 PM, Andy Furniss  wrote:

> Nayan Deshmukh wrote:
>
>> Hi Andy,
>>
>> Thanks for testing the patches!!
>>
>> On Mon, Sep 19, 2016 at 5:24 AM, Andy Furniss 
>> wrote:
>>
>> Andy Furniss wrote:
>>>
>>> Nayan Deshmukh wrote:

 This series implements lanczos interpolation filter.
>
> Andy, I have made some changes to the code. Can you test the
> patches. I hope the artifacts are reduced this time.
>
>
 The artifacts are still there.


>>> :(
>>>
>>
>> The higher levels involve a hell lot of calucations per pixel so the
>> decreased fps is expected. I was thinking of having only 2 levels for
>> lanczos filter ie. 2 and 4.
>>
>> Christian, will it be fine if we only have 2 levels (with kernel size
>> 2 and 4) of lanczos filter corresponding to HIGH_QUALITY_SCALING_L2
>> and L3?
>>
>
> 2 and 4 still have the offset issue, which does sometimes cause the
> white line.
>

Hi Andy

I am able to reproduce the offset issue, I will try to work on the patch
tonight.

Regards,
Nayan.

>
> I've found another issue with 2 and 4 = unscaled with a raster locked
> res test the 1 pix detail will be lost. The detail does re-appear if you
> scale up.
>
> bz2 compressed vid showing the issue -
>
> https://drive.google.com/open?id=0BxP5-S1t9VEEUE5sbUFBV20zSms
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-19 Thread Andy Furniss

Andy Furniss wrote:

Andy Furniss wrote:


bz2 compressed vid showing the issue -

https://drive.google.com/open?id=0BxP5-S1t9VEEUE5sbUFBV20zSms


To be clear this is just the test rez vid I used so you can
possibly recreate the issue your self.


Hmm, interesting, with bicubic, hqscaling=1 this vid behaves
differently with mplayer compared to mpv, the latter looks like
it's scaling a bit, maybe there's an off by one somewhere in mpv
code.


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-19 Thread Andy Furniss

Andy Furniss wrote:


bz2 compressed vid showing the issue -

https://drive.google.com/open?id=0BxP5-S1t9VEEUE5sbUFBV20zSms


To be clear this is just the test rez vid I used so you can
possibly recreate the issue your self.


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-19 Thread Andy Furniss

Nayan Deshmukh wrote:

Hi Andy,

Thanks for testing the patches!!

On Mon, Sep 19, 2016 at 5:24 AM, Andy Furniss 
wrote:


Andy Furniss wrote:


Nayan Deshmukh wrote:


This series implements lanczos interpolation filter.

Andy, I have made some changes to the code. Can you test the
patches. I hope the artifacts are reduced this time.



The artifacts are still there.



:(


The higher levels involve a hell lot of calucations per pixel so the
decreased fps is expected. I was thinking of having only 2 levels for
lanczos filter ie. 2 and 4.

Christian, will it be fine if we only have 2 levels (with kernel size
2 and 4) of lanczos filter corresponding to HIGH_QUALITY_SCALING_L2
and L3?


2 and 4 still have the offset issue, which does sometimes cause the
white line.

I've found another issue with 2 and 4 = unscaled with a raster locked
res test the 1 pix detail will be lost. The detail does re-appear if you
scale up.

bz2 compressed vid showing the issue -

https://drive.google.com/open?id=0BxP5-S1t9VEEUE5sbUFBV20zSms
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-18 Thread Nayan Deshmukh
Hi Andy,

Thanks for testing the patches!!

On Mon, Sep 19, 2016 at 5:24 AM, Andy Furniss  wrote:

> Andy Furniss wrote:
>
>> Nayan Deshmukh wrote:
>>
>>> This series implements lanczos interpolation filter.
>>>
>>> Andy, I have made some changes to the code. Can you test the
>>> patches. I hope the artifacts are reduced this time.
>>>
>>
>> The artifacts are still there.
>>
>
> :(

The higher levels involve a hell lot of calucations per pixel so the
decreased
fps is expected. I was thinking of having only 2 levels for lanczos filter
ie. 2 and 4.

Christian, will it be fine if we only have 2 levels (with kernel size 2 and
4) of
lanczos filter corresponding to HIGH_QUALITY_SCALING_L2 and L3?

Regards,
Nayan.

> To be a bit more precise 2 and 4 seem to be artifact free, unless I
> didn't find the right sample/scale factor. The others show similar
> artifacts to those seen previously.
>
> There is an offset so all images are down and left a bit, though this is
> often not obvious, when scaling down from 2160p to 1080p it causes a
> white line left and top which is very visible.
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-18 Thread Andy Furniss

Andy Furniss wrote:

Nayan Deshmukh wrote:

This series implements lanczos interpolation filter.

Andy, I have made some changes to the code. Can you test the
patches. I hope the artifacts are reduced this time.


The artifacts are still there.


To be a bit more precise 2 and 4 seem to be artifact free, unless I
didn't find the right sample/scale factor. The others show similar
artifacts to those seen previously.

There is an offset so all images are down and left a bit, though this is
often not obvious, when scaling down from 2160p to 1080p it causes a
white line left and top which is very visible.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-18 Thread Andy Furniss

Nayan Deshmukh wrote:

This series implements lanczos interpolation filter.

Andy, I have made some changes to the code. Can you test the patches.
I hope the artifacts are reduced this time.


The artifacts are still there.

In addition 5,6 and 7 take an increasing time to start.
It could be because I run git llvm which may be in a bad
place, but 7 takes 10 seconds to start with one cpu pegged
at 100% in llvm. When it does start I only get about 10 fps
fullscreen. Lower numbers start quicker and give more fps.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 0/2] Implement lanczos interpolation filter

2016-09-18 Thread Nayan Deshmukh
This series implements lanczos interpolation filter.

Andy, I have made some changes to the code. Can you 
test the patches. I hope the artifacts are reduced
this time.

Nayan Deshmukh (2):
  vl: add a lanczos interpolation filter v4.1
  st/vdapu: use lanczos filter for scaling v4

 src/gallium/auxiliary/Makefile.sources   |   2 +
 src/gallium/auxiliary/vl/vl_lanczos_filter.c | 445 +++
 src/gallium/auxiliary/vl/vl_lanczos_filter.h |  63 
 src/gallium/state_trackers/vdpau/mixer.c | 105 --
 src/gallium/state_trackers/vdpau/query.c |   8 +
 src/gallium/state_trackers/vdpau/vdpau_private.h |   7 +
 6 files changed, 602 insertions(+), 28 deletions(-)
 create mode 100644 src/gallium/auxiliary/vl/vl_lanczos_filter.c
 create mode 100644 src/gallium/auxiliary/vl/vl_lanczos_filter.h

-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev