[x264-devel] Re: bug in x264_cqm_init ?

Loren Merritt lorenm at u.washington.edu
Thu May 3 22:00:19 CEST 2007


On Thu, 3 May 2007, Fejes Dávid wrote:

> Memory is never allocated for h->dequant8_mf, h->quant8_mf and 
> h->unquant8_mf.
>
> x264_cqm_init (in common/set.c) will upload this matrices with data,
> but it doesn't allocates any memory before that for these pointers. In
> my build it causes general protection fault (or simply it mess up
> another variables). If I paste the corresponding x264_memalloc
> function calls onto the beginning of the x264_cqm_init, it goes well.
>
> If I'm wrong, please let me know it. I've downloaded x264 at
> 22.07.2007 from the trunk, excuse me if you have corrected this.

Does this patch give an assert failure?
If so, I'll have to rethink my assumptions about compilers. Though I don't 
see how to fix it without adding code complexity.
If not, I can't see how else it would break.

--Loren Merritt
-------------- next part --------------
Index: common/set.c
===================================================================
--- common/set.c	(revision 655)
+++ common/set.c	(working copy)
@@ -83,6 +83,11 @@
                         32 - 11, 32 - 21 };
     int max_qp_err = -1;
 
+    assert((void*)&h->  quant4_mf[4] == (void*)&h->  quant8_mf[0]);
+    assert((void*)&h->dequant4_mf[4] == (void*)&h->dequant8_mf[0]);
+    assert((void*)&h->unquant4_mf[4] == (void*)&h->unquant8_mf[0]);
+    assert((void*)&h->quant4_bias[4] == (void*)&h->quant8_bias[0]);
+
     for( i = 0; i < 6; i++ )
     {
         int size = i<4 ? 16 : 64;


More information about the x264-devel mailing list