diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-04-29 03:32:47 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-04-29 03:32:47 +0200 |
commit | 77010a41fef047bff53536387db7fa043495bb6c (patch) | |
tree | 9e9e10b92cb41eb5babd36c1b42250943686e66e /libavcodec | |
parent | 7c24ca1bda2d4df1dc9b2b982941be532d60da21 (diff) | |
parent | f5ba67ee1342b7741200ff637fc3ea3387b68a1b (diff) | |
download | ffmpeg-77010a41fef047bff53536387db7fa043495bb6c.tar.gz |
Merge commit 'f5ba67ee1342b7741200ff637fc3ea3387b68a1b'
* commit 'f5ba67ee1342b7741200ff637fc3ea3387b68a1b':
flacenc: Move a scratch buffer to struct used by the function
Conflicts:
libavcodec/flacenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/flacenc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 456b555aa7..bc6d00af7f 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -68,6 +68,7 @@ typedef struct RiceContext { enum CodingMode coding_mode; int porder; int params[MAX_PARTITIONS]; + uint32_t udata[FLAC_MAX_BLOCKSIZE]; } RiceContext; typedef struct FlacSubframe { @@ -647,7 +648,6 @@ static uint64_t calc_rice_params(RiceContext *rc, int pmin, int pmax, uint64_t bits[MAX_PARTITION_ORDER+1]; int opt_porder; RiceContext tmp_rc; - uint32_t *udata; uint64_t sums[MAX_PARTITIONS]; av_assert1(pmin >= 0 && pmin <= MAX_PARTITION_ORDER); @@ -656,11 +656,10 @@ static uint64_t calc_rice_params(RiceContext *rc, int pmin, int pmax, tmp_rc.coding_mode = rc->coding_mode; - udata = av_malloc_array(n, sizeof(uint32_t)); for (i = 0; i < n; i++) - udata[i] = (2*data[i]) ^ (data[i]>>31); + rc->udata[i] = (2 * data[i]) ^ (data[i] >> 31); - calc_sum_top(pmax, udata, n, pred_order, sums); + calc_sum_top(pmax, rc->udata, n, pred_order, sums); opt_porder = pmin; bits[pmin] = UINT32_MAX; @@ -675,7 +674,6 @@ static uint64_t calc_rice_params(RiceContext *rc, int pmin, int pmax, calc_sum_next(--i, sums); } - av_freep(&udata); return bits[opt_porder]; } |