Changeset 1273e688ac65d244afc540ba0bcf1b1edf06797b
- Timestamp:
- 03/09/08 22:48:19
(3 months ago)
- Author:
- Antoine Cellerier <dionoea@videolan.org>
- git-committer:
- Antoine Cellerier <dionoea@videolan.org> 1220474899 +0200
- git-parent:
[cb1b8ce047c8b8e2f2ca6863950ee8ff128f4c42]
- git-author:
- Antoine Cellerier <dionoea@videolan.org> 1220474823 +0200
- Message:
Properly malloc(), memcpy() and free() the quantizer matrix. (Somebody please patch libmpeg2 so we can postproc it's output too!) Thanks to fenrir for his help.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2649d28 |
r1273e68 |
|
| 159 | 159 | if( p_picture->pf_release ) |
|---|
| 160 | 160 | p_picture->pf_release( p_picture ); |
|---|
| | 161 | } |
|---|
| | 162 | |
|---|
| | 163 | /** |
|---|
| | 164 | * Cleanup quantization matrix data and set to 0 |
|---|
| | 165 | */ |
|---|
| | 166 | static inline void picture_CleanupQuant( picture_t *p_pic ) |
|---|
| | 167 | { |
|---|
| | 168 | free( p_pic->p_q ); |
|---|
| | 169 | p_pic->p_q = NULL; |
|---|
| | 170 | p_pic->i_qstride = 0; |
|---|
| | 171 | p_pic->i_qtype = 0; |
|---|
| 161 | 172 | } |
|---|
| 162 | 173 | |
|---|
| r0ef30fa |
r1273e68 |
|
| 652 | 652 | |
|---|
| 653 | 653 | p_pic->i_qstride = p_sys->p_ff_pic->qstride; |
|---|
| 654 | | #if 1 |
|---|
| 655 | | p_pic->p_q = p_sys->p_ff_pic->qscale_table; /* XXX: is this dangerous? shouldn't be since the ff pics are never freed ... but you never know */ |
|---|
| 656 | | #else |
|---|
| 657 | | /* FIXME: this leaks p_q */ |
|---|
| 658 | 654 | int i_mb_h = ( p_pic->format.i_height + 15 ) / 16; |
|---|
| 659 | 655 | p_pic->p_q = malloc( p_pic->i_qstride * i_mb_h ); |
|---|
| 660 | 656 | memcpy( p_pic->p_q, p_sys->p_ff_pic->qscale_table, |
|---|
| 661 | 657 | p_pic->i_qstride * i_mb_h ); |
|---|
| 662 | | #endif |
|---|
| 663 | 658 | switch( p_sys->p_ff_pic->qscale_type ) |
|---|
| 664 | 659 | { |
|---|
| r18d635e |
r1273e68 |
|
| 91 | 91 | else |
|---|
| 92 | 92 | { |
|---|
| | 93 | free( p_pic->p_q ); |
|---|
| 93 | 94 | free( p_pic->p_data_orig ); |
|---|
| 94 | 95 | free( p_pic ); |
|---|
| r674559b |
r1273e68 |
|
| 2279 | 2279 | if( p_pic ) |
|---|
| 2280 | 2280 | { |
|---|
| | 2281 | free( p_pic->p_q ); |
|---|
| 2281 | 2282 | free( p_pic->p_data_orig ); |
|---|
| 2282 | 2283 | free( p_pic->p_sys ); |
|---|
| … | … | |
| 2290 | 2291 | p_pic->i_refcount = 0; |
|---|
| 2291 | 2292 | p_pic->i_status = DESTROYED_PICTURE; |
|---|
| | 2293 | picture_CleanupQuant( p_pic ); |
|---|
| 2292 | 2294 | } |
|---|
| 2293 | 2295 | |
|---|
| … | … | |
| 2297 | 2299 | p_pic->i_refcount = 0; |
|---|
| 2298 | 2300 | p_pic->i_status = DESTROYED_PICTURE; |
|---|
| | 2301 | picture_CleanupQuant( p_pic ); |
|---|
| 2299 | 2302 | } |
|---|
| 2300 | 2303 | |
|---|
| re27889c |
r1273e68 |
|
| 710 | 710 | { |
|---|
| 711 | 711 | p_pic->i_status = DESTROYED_PICTURE; |
|---|
| | 712 | picture_CleanupQuant( p_pic ); |
|---|
| 712 | 713 | p_vout->i_heap_size--; |
|---|
| 713 | 714 | } |
|---|
| ree542a4 |
r1273e68 |
|
| 1254 | 1254 | p_picture->i_status = DESTROYED_PICTURE; |
|---|
| 1255 | 1255 | p_vout->i_heap_size--; |
|---|
| | 1256 | picture_CleanupQuant( p_picture ); |
|---|
| 1256 | 1257 | } |
|---|
| 1257 | 1258 | vlc_mutex_unlock( &p_vout->picture_lock ); |
|---|
| r3cbe2bd |
r1273e68 |
|
| 263 | 263 | p_pic->i_status = DESTROYED_PICTURE; |
|---|
| 264 | 264 | p_vout->i_heap_size--; |
|---|
| | 265 | picture_CleanupQuant( p_pic ); |
|---|
| 265 | 266 | |
|---|
| 266 | 267 | vlc_mutex_unlock( &p_vout->picture_lock ); |
|---|
| … | … | |
| 295 | 296 | p_pic->i_status = DESTROYED_PICTURE; |
|---|
| 296 | 297 | p_vout->i_heap_size--; |
|---|
| | 298 | picture_CleanupQuant( p_pic ); |
|---|
| 297 | 299 | } |
|---|
| 298 | 300 | |
|---|
| … | … | |
| 1046 | 1048 | assert( p_picture && p_picture->i_refcount == 0 ); |
|---|
| 1047 | 1049 | |
|---|
| | 1050 | free( p_picture->p_q ); |
|---|
| 1048 | 1051 | free( p_picture->p_data_orig ); |
|---|
| 1049 | 1052 | free( p_picture->p_sys ); |
|---|
| … | … | |
| 1098 | 1101 | *****************************************************************************/ |
|---|
| 1099 | 1102 | |
|---|
| 1100 | | |
|---|