[xiph-commits] r15807 - branches/theora-thusnelda/lib/enc
tterribe at svn.xiph.org
tterribe at svn.xiph.org
Fri Mar 20 23:00:47 PDT 2009
Author: tterribe
Date: 2009-03-20 23:00:46 -0700 (Fri, 20 Mar 2009)
New Revision: 15807
Modified:
branches/theora-thusnelda/lib/enc/codec_internal.h
branches/theora-thusnelda/lib/enc/encode.c
branches/theora-thusnelda/lib/enc/frinit.c
Log:
Dynamicly sized arrays are C99, and MSVC still... isn't.
Modified: branches/theora-thusnelda/lib/enc/codec_internal.h
===================================================================
--- branches/theora-thusnelda/lib/enc/codec_internal.h 2009-03-20 18:02:03 UTC (rev 15806)
+++ branches/theora-thusnelda/lib/enc/codec_internal.h 2009-03-21 06:00:46 UTC (rev 15807)
@@ -221,6 +221,7 @@
unsigned char *frag_coded;
ogg_uint32_t *frag_buffer_index;
ogg_int16_t *frag_dc;
+ ogg_int16_t *frag_dc_tmp;
macroblock_t *macro;
superblock_t *super[3];
Modified: branches/theora-thusnelda/lib/enc/encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encode.c 2009-03-20 18:02:03 UTC (rev 15806)
+++ branches/theora-thusnelda/lib/enc/encode.c 2009-03-21 06:00:46 UTC (rev 15807)
@@ -73,8 +73,10 @@
int h = cpi->frag_h[pi];
int subh = !(pi && cpi->info.pixelformat != OC_PF_444);
int subv = !(pi && cpi->info.pixelformat == OC_PF_420);
- ogg_int16_t dc[h];
- ogg_int16_t down[h];
+ ogg_int16_t *dc;
+ ogg_int16_t *down;
+ dc=cpi->frag_dc_tmp;
+ down=cpi->frag_dc_tmp+h;
for(x=0;x<3;x++)last[x]=0;
@@ -82,8 +84,8 @@
macroblock_t *mb_row = cpi->macro + (y>>subv)*cpi->macro_h;
macroblock_t *mb_down = cpi->macro + ((y-1)>>subv)*cpi->macro_h;
- memcpy(down,dc,sizeof(down));
- memcpy(dc,cpi->frag_dc+fi,sizeof(dc));
+ memcpy(down,dc,h*sizeof(*down));
+ memcpy(dc,cpi->frag_dc+fi,h*sizeof(*dc));
for (x=0; x<h; x++, fi++) {
if(cp[fi]) {
Modified: branches/theora-thusnelda/lib/enc/frinit.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frinit.c 2009-03-20 18:02:03 UTC (rev 15806)
+++ branches/theora-thusnelda/lib/enc/frinit.c 2009-03-21 06:00:46 UTC (rev 15807)
@@ -31,6 +31,7 @@
if(cpi->frag_coded) _ogg_free(cpi->frag_coded);
if(cpi->frag_buffer_index) _ogg_free(cpi->frag_buffer_index);
if(cpi->frag_dc) _ogg_free(cpi->frag_dc);
+ if(cpi->frag_dc_tmp) _ogg_free(cpi->frag_dc_tmp);
#ifdef COLLECT_METRICS
if(cpi->frag_mbi) _ogg_free(cpi->frag_mbi);
if(cpi->frag_sad) _ogg_free(cpi->frag_sad);
@@ -116,6 +117,7 @@
cpi->frag_coded = calloc(cpi->frag_total+1, sizeof(*cpi->frag_coded));
cpi->frag_buffer_index = calloc(cpi->frag_total, sizeof(*cpi->frag_buffer_index));
cpi->frag_dc = calloc(cpi->frag_total, sizeof(*cpi->frag_dc));
+ cpi->frag_dc_tmp = calloc(2*cpi->frag_h[0], sizeof(*cpi->frag_dc_tmp));
/* +1; the last entry is the 'invalid' mb, which contains only 'invalid' frags */
cpi->macro = calloc(cpi->macro_total+1, sizeof(*cpi->macro));
More information about the commits
mailing list