[PATCH] [RESEND] -aspect-tolerenace option
Hi, this patch introduces the aspect tolerance option. When decodding mpeg material, there is a prescaling step involved that takes care of expanding the frames to the right aspect ratio. Scaling is a process that does however reduce the quality, so ideally we would avoid it. The option actually is meant to avoid if if the prescaling done for the aspect ratio is actually only making a tiny correction. This can happen due to roundoff errors, e.g. 1366x768 vs 1360x768 or 1360x766. Default is 0.01, which means that we'll avoid prescaling for up to 0.01 error in the aspect ratio (0.56% for 16:9). Aspect inaccuracies of that size are typically more acceptable than the loss of quality by prescaling (at least for high quality material). Behavior can be controlled via the -aspect-tolerance option. Best, -- Kurt Garloff <kurt@garloff.de> [Koeln, DE] Physics:Plasma modeling <garloff@plasimo.phys.tue.nl> [TU Eindhoven, NL] Linux: VP PM OPS <garloff@suse.de> [Novell Inc]
On Wed, Apr 09, 2008 at 06:47:32AM +0200, Kurt Garloff wrote:
this patch introduces the aspect tolerance option. When decodding mpeg material, there is a prescaling step involved that takes care of expanding the frames to the right aspect ratio.
--- mplayer/DOCS/man/en/mplayer.1.orig 2008-03-24 14:31:56.000000000 +0100 +++ mplayer/DOCS/man/en/mplayer.1 2008-03-31 10:25:37.000000000 +0200 @@ -4262,6 +4262,21 @@ incorrect or missing in the file being p . .TP +.B \-aspect\-tolerance <0.0\-1.5> +When decoding, the video material is prescaled from the encoding +resolution to the advertised aspect ratio (e.g. from 720x576 +encoded PAL information to 768x576 with 4:3 aspect). Prescaling does
Please put new sentences on new lines in the man page. Diego
Diego, On Wed, Apr 09, 2008 at 04:27:42PM +0200, Diego Biurrun wrote:
On Wed, Apr 09, 2008 at 06:47:32AM +0200, Kurt Garloff wrote:
--- mplayer/DOCS/man/en/mplayer.1.orig 2008-03-24 14:31:56.000000000 +0100 +++ mplayer/DOCS/man/en/mplayer.1 2008-03-31 10:25:37.000000000 +0200 @@ -4262,6 +4262,21 @@ incorrect or missing in the file being p . .TP +.B \-aspect\-tolerance <0.0\-1.5> +When decoding, the video material is prescaled from the encoding +resolution to the advertised aspect ratio (e.g. from 720x576 +encoded PAL information to 768x576 with 4:3 aspect). Prescaling does
Please put new sentences on new lines in the man page.
OK will do. Simple enough ;-) Any other comments on the patch? Cheers, -- Kurt Garloff <kurt@garloff.de> [Koeln, DE] Physics:Plasma modeling <garloff@plasimo.phys.tue.nl> [TU Eindhoven, NL] Linux: VP PM OPS <garloff@suse.de> [Novell Inc]
Hi, On Fri, Apr 11, 2008 at 06:01:39PM +0200, Kurt Garloff wrote:
OK will do. Simple enough ;-) Any other comments on the patch?
Rediffed and put newlines before new sentences in the man page. Best, -- Kurt Garloff <kurt@garloff.de> [Koeln, DE] Physics:Plasma modeling <garloff@plasimo.phys.tue.nl> [TU Eindhoven, NL] Linux: VP PM OPS <garloff@suse.de> [Novell Inc]
On Sat, 12 Apr 2008 01:58:10 +0200, Kurt Garloff wrote:
Hi,
On Fri, Apr 11, 2008 at 06:01:39PM +0200, Kurt Garloff wrote:
OK will do. Simple enough ;-) Any other comments on the patch?
Rediffed and put newlines before new sentences in the man page.
Best,
idea sounds good, but i'm no programmer have to wait for a review :) -compn
On Sat, Apr 12, 2008 at 01:58:10AM +0200, Kurt Garloff wrote:
On Fri, Apr 11, 2008 at 06:01:39PM +0200, Kurt Garloff wrote:
OK will do. Simple enough ;-) Any other comments on the patch?
Rediffed and put newlines before new sentences in the man page.
Sorry for being late, but this can't be done properly in vd.c, aspect.c is the only place where it _can_ be done (not sure if _all_ necessary information is available though), just try your patch with e.g. -monitoraspect 0.3 and you'll see it does not work at all. Also, the old behaviour should be kept as default. In addition as I understood your description, avoiding aspect scaling is not at all what you want, you want to avoid scaling if it makes little difference. In that case something like this:
Index: libvo/aspect.c =================================================================== --- libvo/aspect.c (revision 26401) +++ libvo/aspect.c (working copy) @@ -96,6 +96,8 @@ #endif } } + if (FFABS(*srch, aspdat.orgh) < 10) *srch = aspdat.orgh; + if (FFABS(*srcw, aspdat.orgw) < 10) *srcw = aspdat.orgw; aspdat.asp=*srcw / (float)*srch; #ifdef ASPECT_DEBUG printf("aspect(3) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh);
Seems to me more like what you want. Greetings, Reimar Döffinger
On Sat, Apr 12, 2008 at 10:40:45AM +0200, Reimar Döffinger wrote:
In that case something like this:
Index: libvo/aspect.c =================================================================== --- libvo/aspect.c (revision 26401) +++ libvo/aspect.c (working copy) @@ -96,6 +96,8 @@ #endif } } + if (FFABS(*srch, aspdat.orgh) < 10) *srch = aspdat.orgh; + if (FFABS(*srcw, aspdat.orgw) < 10) *srcw = aspdat.orgw; aspdat.asp=*srcw / (float)*srch; #ifdef ASPECT_DEBUG printf("aspect(3) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh);
Seems to me more like what you want.
Attached patch actually works. Greetings, Reimar Döffinger
Reimar,
On Sat, Apr 12, 2008 at 10:40:45AM +0200, Reimar Döffinger wrote:
In that case something like this:
Index: libvo/aspect.c =================================================================== --- libvo/aspect.c (revision 26401) +++ libvo/aspect.c (working copy) @@ -96,6 +96,8 @@ #endif } } + if (FFABS(*srch, aspdat.orgh) < 10) *srch = aspdat.orgh; + if (FFABS(*srcw, aspdat.orgw) < 10) *srcw = aspdat.orgw; aspdat.asp=*srcw / (float)*srch; #ifdef ASPECT_DEBUG printf("aspect(3) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh);
Seems to me more like what you want.
Thanks for your patch. I think it helps when your output aspect is a tiny bit off. However, it does not help my problem, when a rounding error leads to the encoded movie not matching the recorded aspect exactly: garloff@core2:/usr/src/video/mplayer [1]$ ./mplayer -aspect-tolerance 0 /media/VIDEO-2/Trailer.avi [...] Starting playback... VDec: vo config request - 1360 x 766 (preferred colorspace: Planar YV12) VDec: using Planar YV12 as output csp (no 0) Movie-Aspect is 1.78:1 - prescaling to correct movie aspect. VO: [xv] 1360x766 => 1362x766 Planar YV12 ^^^^^^^^^^^^^^^^^^^^ I think both patches are needed. Best, -- Kurt Garloff <kurt@garloff.de> [Koeln, DE] Physics:Plasma modeling <garloff@plasimo.phys.tue.nl> [TU Eindhoven, NL] Linux: VP PM OPS <garloff@suse.de> [Novell Inc]
participants (4)
-
Compn -
Diego Biurrun -
Kurt Garloff -
Reimar Döffinger