Mercurial > mplayer.hg
comparison libswscale/swscale-test.c @ 31868:46473d005417
indent
author | ramiro |
---|---|
date | Sun, 08 Aug 2010 18:18:13 +0000 |
parents | 6ef694f86f3a |
children | 989b68128b45 |
comparison
equal
deleted
inserted
replaced
31867:6ef694f86f3a | 31868:46473d005417 |
---|---|
92 * they're freed appropriately (such as using av_free for buffers | 92 * they're freed appropriately (such as using av_free for buffers |
93 * allocated with av_malloc). */ | 93 * allocated with av_malloc). */ |
94 /* An extra 16 bytes is being allocated because some scalers may write | 94 /* An extra 16 bytes is being allocated because some scalers may write |
95 * out of bounds. */ | 95 * out of bounds. */ |
96 if (dstStride[i]) | 96 if (dstStride[i]) |
97 dst[i]= av_mallocz(dstStride[i]*dstH+16); | 97 dst[i]= av_mallocz(dstStride[i]*dstH+16); |
98 if (refStride[i]) | 98 if (refStride[i]) |
99 out[i]= av_mallocz(refStride[i]*h); | 99 out[i]= av_mallocz(refStride[i]*h); |
100 if ((dstStride[i] && !dst[i]) || (refStride[i] && !out[i])) { | 100 if ((dstStride[i] && !dst[i]) || (refStride[i] && !out[i])) { |
101 perror("Malloc"); | 101 perror("Malloc"); |
102 res = -1; | 102 res = -1; |
103 | 103 |
104 goto end; | 104 goto end; |
157 sws_freeContext(dstContext); | 157 sws_freeContext(dstContext); |
158 sws_freeContext(outContext); | 158 sws_freeContext(outContext); |
159 | 159 |
160 for (i=0; i<4; i++) { | 160 for (i=0; i<4; i++) { |
161 if (dstStride[i]) | 161 if (dstStride[i]) |
162 av_free(dst[i]); | 162 av_free(dst[i]); |
163 if (refStride[i]) | 163 if (refStride[i]) |
164 av_free(out[i]); | 164 av_free(out[i]); |
165 } | 165 } |
166 | 166 |
167 return res; | 167 return res; |
168 } | 168 } |
169 | 169 |
200 int srcStride[4]; | 200 int srcStride[4]; |
201 int p; | 201 int p; |
202 av_fill_image_linesizes(srcStride, srcFormat, srcW); | 202 av_fill_image_linesizes(srcStride, srcFormat, srcW); |
203 for (p = 0; p < 4; p++) { | 203 for (p = 0; p < 4; p++) { |
204 if (srcStride[p]) | 204 if (srcStride[p]) |
205 src[p] = av_mallocz(srcStride[p]*srcH+16); | 205 src[p] = av_mallocz(srcStride[p]*srcH+16); |
206 if (srcStride[p] && !src[p]) { | 206 if (srcStride[p] && !src[p]) { |
207 perror("Malloc"); | 207 perror("Malloc"); |
208 return; | 208 return; |
209 } | 209 } |
210 } | 210 } |
225 srcW, srcH, dstW[i], dstH[j], flags[k]); | 225 srcW, srcH, dstW[i], dstH[j], flags[k]); |
226 | 226 |
227 sws_freeContext(srcContext); | 227 sws_freeContext(srcContext); |
228 for (p = 0; p < 4; p++) | 228 for (p = 0; p < 4; p++) |
229 if (srcStride[p]) | 229 if (srcStride[p]) |
230 av_free(src[p]); | 230 av_free(src[p]); |
231 } | 231 } |
232 } | 232 } |
233 } | 233 } |
234 } | 234 } |
235 | 235 |