changeset 18569:d8605d22bf62

document the recent changes in Snow. new lavcopts: 'refs', 'vqscale=0'
author lorenm
date Mon, 05 Jun 2006 05:34:26 +0000
parents 80628a6d0980
children 303fea73000a
files DOCS/man/en/mplayer.1 DOCS/tech/snow.txt libmpcodecs/ve_lavc.c
diffstat 3 files changed, 42 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Mon Jun 05 05:02:47 2006 +0000
+++ b/DOCS/man/en/mplayer.1	Mon Jun 05 05:34:26 2006 +0000
@@ -7925,6 +7925,11 @@
 This has a significant effect on speed.
 .
 .TP
+.B refs=<1\-8>
+number of reference frames to consider for motion compensation
+(Snow only) (default: 1)
+.
+.TP
 .B psnr\ \ \ 
 print the PSNR (peak signal to noise ratio) for the whole video after encoding
 and store the per frame PSNR in a file with a name like 'psnr_hhmmss.log'.
--- a/DOCS/tech/snow.txt	Mon Jun 05 05:02:47 2006 +0000
+++ b/DOCS/tech/snow.txt	Mon Jun 05 05:34:26 2006 +0000
@@ -12,22 +12,18 @@
 
 OPTIONS RECOGNIZED BY SNOW
 
- * vqscale=<0.01-255>
-   Encoding quality, sane range 1-10, default: 0 (lossless). May be
-   fractional.
+ * vqscale=<0.0-255.0>
+   Encoding quality, sane range 1-10. 0 is lossless.
+   May be fractional.
    A given quality in snow needs a somewhat lower qscale than the same
    quality in MPEG-4.
-   Note that 0 may not be specified; if you want lossless encoding, you
-   must leave out vqscale.
 
  * vpass=<1-3>
    Activates internal two (or more) pass mode.
 
  * vbitrate=<value>
-   Specify bitrate of the 2nd pass.
-   Don't use it for 1st pass as CBR isn't implemented yet, use vqscale
-   instead, and set it to a quantizer near the target average quant
-   of the final encode.
+   Specify bitrate of 1pass CBR or 2pass ABR. default: 800 kbit/s.
+   This is not very accurate for short videos.
 
  * lmin, lmax, vqcomp, vratetol, vrc_eq, vrc_override
    Generic multipass ratecontrol options, subject to the same suggestions
@@ -36,15 +32,24 @@
 
  * cmp, subcmp, mbcmp
    Set the comparison function, default: 0 (SAD).
-   useful values = 0 (SAD), 1 (SSD), 11 (5/3 wavelet), 12 (9/7 wavelet).
-   Experience shows that SSD is the best most of the time, while SAD is
-   slightly better the remainder of the time.
+   useful values = 0 (SAD), 1 (SSD), 2 (SATD), 
+                   11 (5/3 wavelet), 12 (9/7 wavelet).
+   SAD is fastest and lowest quality.
+   SSD is the only function that makes correct decisions about intra vs
+   inter (mbcmp) when using fast motion estimation, but is not the best for
+   the actual search (cmp, subcmp).
+   The wavelet functions (use the one that matches pred) are best quality,
+   especially whith vme=8, but are very slow.
+   SATD is a good balance.
    You can add 256 to any of the options to enable chroma motion
    estimation for that comparison (e.g. mbcmp=257 for SSD with chroma),
    but it doesn't seem to help much for the moment.
 
  * pred=<0-2>
-   Wavelet type. 0 (9/7 wavelet), 1 (5/3 wavelet), 2 (13/7 wavelet).
+   Wavelet type.
+   0 = 9/7 wavelet, default.
+   1 = 5/3 wavelet.
+   2 = 13/7 wavelet.
    9/7 is probably better for for lossy coding, and 5/3 for lossless.
    NOTE: 9/7 wavelet doesn't work with lossless mode.
 
@@ -55,6 +60,7 @@
 
  * v4mv
    Allows smaller motion partitions, default: off.
+   v4mv is theoretically good, but in practice isn't really working yet.
    The current MB decision algorithm doesn't make very good use of this:
    It improves quality, but also increases bitrate. (You could get
    more quality per bitrate by reducing quantizer instead.)
@@ -67,10 +73,18 @@
    Iterative ME currently does not perform scenecut detection, so should
    be used only in the second pass of a two pass encode.
 
-v4mv and the wavelet cmp functions are theoretically good, but in practice
-aren't really working yet.
+ * refs=<1-8>
+   Allows each block to choose which of several reference frames to
+   motion compensate from. Defult: 1. Larger values always improve
+   compression, but cost lots of CPU-time when encoding and extra
+   memory when decoding.
 
 In short:
 The best options in almost all cases are
-vcodec=snow:vstrict=-2:vpass=1:vqscale=$N:pred=0:cmp=1:subcmp=1:mbcmp=1:qpel
-vcodec=snow:vstrict=-2:vpass=2:vbitrate=$B:pred=0:cmp=1:subcmp=1:mbcmp=1:qpel:vme=8
+vcodec=snow:vstrict=-2:vpass=1:vbitrate=$B:pred=0:cmp=2:subcmp=2:mbcmp=1:qpel
+vcodec=snow:vstrict=-2:vpass=2:vbitrate=$B:pred=0:cmp=12:subcmp=12:mbcmp=1:qpel:vme=8:refs=8
+
+Decent, fast options are
+vcodec=snow:vstrict=-2:vpass=1:vbitrate=$B:pred=0:cmp=1:subcmp=1:mbcmp=1
+vcodec=snow:vstrict=-2:vpass=2:vbitrate=$B:pred=0:cmp=2:subcmp=2:mbcmp=1:refs=2
+
--- a/libmpcodecs/ve_lavc.c	Mon Jun 05 05:02:47 2006 +0000
+++ b/libmpcodecs/ve_lavc.c	Mon Jun 05 05:34:26 2006 +0000
@@ -58,7 +58,7 @@
 static int lavc_param_mb_decision = 0; /* default is realtime encoding */
 static int lavc_param_v4mv = 0;
 static int lavc_param_vme = 4;
-static float lavc_param_vqscale = 0.0;
+static float lavc_param_vqscale = -1;
 static int lavc_param_vqmin = 2;
 static int lavc_param_vqmax = 31;
 static int lavc_param_mb_qmin = 2;
@@ -161,6 +161,7 @@
 static int lavc_param_sc_factor = 1;
 static int lavc_param_video_global_header= 0;
 static int lavc_param_mv0_threshold = 256;
+static int lavc_param_refs = 1;
 
 char *lavc_param_acodec = "mp2";
 int lavc_param_atag = 0;
@@ -181,7 +182,7 @@
 	{"mbd", &lavc_param_mb_decision, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL},
 	{"v4mv", &lavc_param_v4mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"vme", &lavc_param_vme, CONF_TYPE_INT, CONF_RANGE, 0, 8, NULL},
-	{"vqscale", &lavc_param_vqscale, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 255.0, NULL},
+	{"vqscale", &lavc_param_vqscale, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 255.0, NULL},
 	{"vqmin", &lavc_param_vqmin, CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL},
 	{"vqmax", &lavc_param_vqmax, CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL},
 	{"mbqmin", &lavc_param_mb_qmin, CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL},
@@ -321,6 +322,7 @@
 	{"vglobal", &lavc_param_video_global_header, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
 	{"aglobal", &lavc_param_audio_global_header, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
 	{"mv0_threshold", &lavc_param_mv0_threshold, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL},
+	{"refs", &lavc_param_refs, CONF_TYPE_INT, CONF_RANGE, 1, 16, NULL},
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 #endif
@@ -652,6 +654,7 @@
         lavc_venc_context->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
     }
     lavc_venc_context->mv0_threshold = lavc_param_mv0_threshold;
+    lavc_venc_context->refs = lavc_param_refs;
 
     switch(lavc_param_format)
     {
@@ -741,7 +744,7 @@
     lavc_venc_context->me_method = ME_ZERO+lavc_param_vme;
 
     /* fixed qscale :p */
-    if (lavc_param_vqscale)
+    if (lavc_param_vqscale >= 0.0)
     {
 	mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_MPCODECS_UsingConstantQscale, lavc_param_vqscale);
 	lavc_venc_context->flags |= CODEC_FLAG_QSCALE;