changeset 2458:915094e3da5d libavcodec

dont use several 100 mb memory for a tiny 120 element table remove redundant code related to av_free() typo fix
author michael
date Sun, 23 Jan 2005 22:54:51 +0000
parents 1bae913cb46c
children 7a875ef7597b
files vc9.c
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/vc9.c	Sun Jan 23 22:49:41 2005 +0000
+++ b/vc9.c	Sun Jan 23 22:54:51 2005 +0000
@@ -147,7 +147,7 @@
 static VLC vc9_cbpcy_p_vlc[4];
 #define VC9_4MV_BLOCK_PATTERN_VLC_BITS 6
 static VLC vc9_4mv_block_pattern_vlc[4];
-#define VC9_LUMA_DC_VLC_BITS 26
+#define VC9_LUMA_DC_VLC_BITS 9
 static VLC vc9_luma_dc_vlc[2];
 
 typedef struct VC9Context{
@@ -310,7 +310,7 @@
             INIT_VLC(&vc9_mv_diff_vlc[i], VC9_MV_DIFF_VLC_BITS, 73,
                      vc9_mv_diff_bits[i], 1, 1,
                      vc9_mv_diff_codes[i], 2, 2, 1);
-            INIT_VLC(&vc9_luma_dc_vlc[i], VC9_LUMA_DC_VLC_BITS, 26,
+            INIT_VLC(&vc9_luma_dc_vlc[i], VC9_LUMA_DC_VLC_BITS, 120,
                      vc9_luma_dc_bits[i], 1, 1,
                      vc9_luma_dc_codes[i], 4, 4, 1);
             INIT_VLC(&vc9_ttmb_vlc[i], VC9_TTMB_VLC_BITS, 16,
@@ -331,16 +331,14 @@
 
     if (v->hrd_rate || num != v->hrd_num_leaky_buckets)
     {
-        av_free(v->hrd_rate);
-        v->hrd_rate = NULL;
+        av_freep(&v->hrd_rate);
     }
     if (!v->hrd_rate) v->hrd_rate = av_malloc(num);
     if (!v->hrd_rate) return -1;
 
     if (v->hrd_buffer || num != v->hrd_num_leaky_buckets)
     {
-        av_free(v->hrd_buffer);
-        v->hrd_buffer = NULL;
+        av_freep(&v->hrd_buffer);
     }
     if (!v->hrd_buffer) v->hrd_buffer = av_malloc(num);
     if (!v->hrd_buffer) return -1;
@@ -1687,12 +1685,12 @@
     VC9Context *v = avctx->priv_data;
 
 #if HAS_ADVANCED_PROFILE
-    if (v->hrd_rate) av_free(v->hrd_rate);
-    if (v->hrd_buffer) av_free(v->hrd_buffer);
+    av_freep(&v->hrd_rate);
+    av_freep(&v->hrd_buffer);
 #endif
-    if (v->mv_type_mb_plane) av_free(v->mv_type_mb_plane);
-    if (v->skip_mb_plane) av_free(v->skip_mb_plane);
-    if (v->direct_mb_plane) av_free(v->direct_mb_plane);
+    av_freep(&v->mv_type_mb_plane);
+    av_freep(&v->skip_mb_plane);
+    av_freep(&v->direct_mb_plane);
     return 0;
 }