On Sun, 6 Apr 2014, Timothy Gu  wrote:

Module: libav
Branch: master
Commit: 5ce7ca68b86856ee8e9d6530dffdadc4eca4f8d1

Author:    Timothy Gu <[email protected]>
Committer: Vittorio Giovara <[email protected]>
Date:      Tue Jul 30 19:39:06 2013 -0700

libxvid: add working lumimasking and variance AQ

The old implementation is unusable due to changes in the Xvid API.
Further fixes by Michael Niedermayer <[email protected]>.

Signed-off-by: Vittorio Giovara <[email protected]>

---

doc/encoders.texi    |   13 +++++++++++++
libavcodec/libxvid.c |   47 +++++++++++++++++++++++++++++++++++++++++++++--
libavcodec/version.h |    2 +-
3 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 24692b7..5c0e489 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -505,6 +505,19 @@ Small-sized colorful images
Text-like
@end table

+@item lumi_aq
+Enable lumi masking adaptive quantization when set to 1. Default is 0
+(disabled).
+
+@item variance_aq
+Enable variance adaptive quantization when set to 1. Default is 0
+(disabled).
+
+When combined with @option{lumi_aq}, the resulting quality will not
+be better than any of the two specified individually. In other
+words, the resulting quality will be the worse one of the two
+effects.
+
@end table

@section libx264
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index fe68c8e..42614ea 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -46,6 +46,7 @@
 * This stores all the private context for the codec.
 */
struct xvid_context {
+    AVClass *class;                /**< Handle for Xvid encoder */
    void *encoder_handle;          /**< Handle for Xvid encoder */
    int xsize;                     /**< Frame x size */
    int ysize;                     /**< Frame y size */
@@ -59,6 +60,8 @@ struct xvid_context {
    char *twopassfile;             /**< second pass temp file name */
    unsigned char *intra_matrix;   /**< P-Frame Quant Matrix */
    unsigned char *inter_matrix;   /**< I-Frame Quant Matrix */
+    int lumi_aq;                   /**< Lumi masking as an aq method */
+    int variance_aq;               /**< Variance adaptive quantization */
};

/**
@@ -349,6 +352,8 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)  
{
    xvid_plugin_single_t single       = { 0 };
    struct xvid_ff_pass1 rc2pass1     = { 0 };
    xvid_plugin_2pass2_t rc2pass2     = { 0 };
+    xvid_plugin_lumimasking_t masking_l = { 0 }; /* For lumi masking */
+    xvid_plugin_lumimasking_t masking_v = { 0 }; /* For variance AQ */
    xvid_gbl_init_t xvid_gbl_init     = { 0 };
    xvid_enc_create_t xvid_enc_create = { 0 };
    xvid_enc_plugin_t plugins[7];
@@ -518,10 +523,32 @@ static av_cold int xvid_encode_init(AVCodecContext 
*avctx)  {
        xvid_enc_create.num_plugins++;
    }

+    if (avctx->lumi_masking != 0.0)
+        x->lumi_aq = 1;
+
+    if (x->lumi_aq && x->variance_aq) {
+        x->variance_aq = 0
+        av_log(avctx, AV_LOG_WARNING,
+               "variance_aq is ignored when lumi_aq is set.\n");
+    }

libavcodec/libxvid.c:534:9: error: expected ';' before 'av_log'

https://fate.libav.org/x86_32-linux-gcc-extras/20140407113401

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to