Commit a1442afe authored by michael's avatar michael

dont use several 100 mb memory for a tiny 120 element table

remove redundant code related to av_free()
typo fix


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@3878 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent e86c90a3
...@@ -147,7 +147,7 @@ static VLC vc9_cbpcy_i_vlc; ...@@ -147,7 +147,7 @@ static VLC vc9_cbpcy_i_vlc;
static VLC vc9_cbpcy_p_vlc[4]; static VLC vc9_cbpcy_p_vlc[4];
#define VC9_4MV_BLOCK_PATTERN_VLC_BITS 6 #define VC9_4MV_BLOCK_PATTERN_VLC_BITS 6
static VLC vc9_4mv_block_pattern_vlc[4]; 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]; static VLC vc9_luma_dc_vlc[2];
typedef struct VC9Context{ typedef struct VC9Context{
...@@ -310,7 +310,7 @@ static int init_common(VC9Context *v) ...@@ -310,7 +310,7 @@ static int init_common(VC9Context *v)
INIT_VLC(&vc9_mv_diff_vlc[i], VC9_MV_DIFF_VLC_BITS, 73, INIT_VLC(&vc9_mv_diff_vlc[i], VC9_MV_DIFF_VLC_BITS, 73,
vc9_mv_diff_bits[i], 1, 1, vc9_mv_diff_bits[i], 1, 1,
vc9_mv_diff_codes[i], 2, 2, 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_bits[i], 1, 1,
vc9_luma_dc_codes[i], 4, 4, 1); vc9_luma_dc_codes[i], 4, 4, 1);
INIT_VLC(&vc9_ttmb_vlc[i], VC9_TTMB_VLC_BITS, 16, INIT_VLC(&vc9_ttmb_vlc[i], VC9_TTMB_VLC_BITS, 16,
...@@ -331,16 +331,14 @@ static int decode_hrd(VC9Context *v, GetBitContext *gb) ...@@ -331,16 +331,14 @@ static int decode_hrd(VC9Context *v, GetBitContext *gb)
if (v->hrd_rate || num != v->hrd_num_leaky_buckets) if (v->hrd_rate || num != v->hrd_num_leaky_buckets)
{ {
av_free(v->hrd_rate); av_freep(&v->hrd_rate);
v->hrd_rate = NULL;
} }
if (!v->hrd_rate) v->hrd_rate = av_malloc(num); if (!v->hrd_rate) v->hrd_rate = av_malloc(num);
if (!v->hrd_rate) return -1; if (!v->hrd_rate) return -1;
if (v->hrd_buffer || num != v->hrd_num_leaky_buckets) if (v->hrd_buffer || num != v->hrd_num_leaky_buckets)
{ {
av_free(v->hrd_buffer); av_freep(&v->hrd_buffer);
v->hrd_buffer = NULL;
} }
if (!v->hrd_buffer) v->hrd_buffer = av_malloc(num); if (!v->hrd_buffer) v->hrd_buffer = av_malloc(num);
if (!v->hrd_buffer) return -1; if (!v->hrd_buffer) return -1;
...@@ -1687,12 +1685,12 @@ static int vc9_decode_end(AVCodecContext *avctx) ...@@ -1687,12 +1685,12 @@ static int vc9_decode_end(AVCodecContext *avctx)
VC9Context *v = avctx->priv_data; VC9Context *v = avctx->priv_data;
#if HAS_ADVANCED_PROFILE #if HAS_ADVANCED_PROFILE
if (v->hrd_rate) av_free(v->hrd_rate); av_freep(&v->hrd_rate);
if (v->hrd_buffer) av_free(v->hrd_buffer); av_freep(&v->hrd_buffer);
#endif #endif
if (v->mv_type_mb_plane) av_free(v->mv_type_mb_plane); av_freep(&v->mv_type_mb_plane);
if (v->skip_mb_plane) av_free(v->skip_mb_plane); av_freep(&v->skip_mb_plane);
if (v->direct_mb_plane) av_free(v->direct_mb_plane); av_freep(&v->direct_mb_plane);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment