comparison libvo/vo_md5sum.c @ 18882:21f45afa0f87

use libavutil's md5 implementation instead of local imported copy
author ivo
date Sun, 02 Jul 2006 20:22:59 +0000
parents fd51fd1ff231
children e11fcd7d223c
comparison
equal deleted inserted replaced
18881:27a9bb3b9b9a 18882:21f45afa0f87
8 * Licensed under GNU General Public License version 2. 8 * Licensed under GNU General Public License version 2.
9 * 9 *
10 * 10 *
11 * Changelog 11 * Changelog
12 * 12 *
13 * 2006-07-02 Removed imported md5sum code and rely on libavutil now
13 * 2005-01-16 Replaced suboption parser by call to subopt-helper. 14 * 2005-01-16 Replaced suboption parser by call to subopt-helper.
14 * 2004-09-16 Second draft. It now acts on VOCTRL_DRAW_IMAGE and does not 15 * 2004-09-16 Second draft. It now acts on VOCTRL_DRAW_IMAGE and does not
15 * maintain a local copy of the image if the format is YV12. 16 * maintain a local copy of the image if the format is YV12.
16 * Speed improvement and uses less memory. 17 * Speed improvement and uses less memory.
17 * 2004-09-13 First draft. 18 * 2004-09-13 First draft.
36 #include "mp_msg.h" 37 #include "mp_msg.h"
37 #include "video_out.h" 38 #include "video_out.h"
38 #include "video_out_internal.h" 39 #include "video_out_internal.h"
39 #include "mplayer.h" /* for exit_player() */ 40 #include "mplayer.h" /* for exit_player() */
40 #include "help_mp.h" 41 #include "help_mp.h"
41 #include "md5sum.h" 42 #include "libavutil/md5.h"
42 43
43 /* ------------------------------------------------------------------------- */ 44 /* ------------------------------------------------------------------------- */
44 45
45 /* Defines */ 46 /* Defines */
46 47
199 uint8_t *planeV = mpi->planes[2]; 200 uint8_t *planeV = mpi->planes[2];
200 uint32_t strideY = mpi->stride[0]; 201 uint32_t strideY = mpi->stride[0];
201 uint32_t strideU = mpi->stride[1]; 202 uint32_t strideU = mpi->stride[1];
202 uint32_t strideV = mpi->stride[2]; 203 uint32_t strideV = mpi->stride[2];
203 204
204 auth_md5Ctx md5_context; 205 uint8_t md5_context_memory[av_md5_size];
206 struct AVMD5 *md5_context = (struct AVMD5*) md5_context_memory;
205 unsigned int i; 207 unsigned int i;
206 208
207 if (mpi->flags & MP_IMGFLAG_PLANAR) { /* Planar */ 209 if (mpi->flags & MP_IMGFLAG_PLANAR) { /* Planar */
208 if (mpi->flags & MP_IMGFLAG_YUV) { /* Planar YUV */ 210 if (mpi->flags & MP_IMGFLAG_YUV) { /* Planar YUV */
209 auth_md5InitCtx(&md5_context); 211 av_md5_init(md5_context);
210 for (i=0; i<h; i++) { 212 for (i=0; i<h; i++) {
211 auth_md5SumCtx(&md5_context, planeY + i * strideY, w); 213 av_md5_update(md5_context, planeY + i * strideY, w);
212 } 214 }
213 w = w / 2; 215 w = w / 2;
214 h = h / 2; 216 h = h / 2;
215 for (i=0; i<h; i++) { 217 for (i=0; i<h; i++) {
216 auth_md5SumCtx(&md5_context, planeU + i * strideU, w); 218 av_md5_update(md5_context, planeU + i * strideU, w);
217 auth_md5SumCtx(&md5_context, planeV + i * strideV, w); 219 av_md5_update(md5_context, planeV + i * strideV, w);
218 } 220 }
219 auth_md5CloseCtx(&md5_context, md5sum); 221 av_md5_final(md5_context, md5sum);
220 md5sum_output_sum(md5sum); 222 md5sum_output_sum(md5sum);
221 return VO_TRUE; 223 return VO_TRUE;
222 } else { /* Planar RGB */ 224 } else { /* Planar RGB */
223 return VO_FALSE; 225 return VO_FALSE;
224 } 226 }
225 } else { /* Packed */ 227 } else { /* Packed */
226 if (mpi->flags & MP_IMGFLAG_YUV) { /* Packed YUV */ 228 if (mpi->flags & MP_IMGFLAG_YUV) { /* Packed YUV */
227 229
228 return VO_FALSE; 230 return VO_FALSE;
229 } else { /* Packed RGB */ 231 } else { /* Packed RGB */
230 auth_md5Sum(md5sum, rgbimage, mpi->w * (mpi->bpp >> 3) * mpi->h); 232 av_md5_sum(md5sum, rgbimage, mpi->w * (mpi->bpp >> 3) * mpi->h);
231 md5sum_output_sum(md5sum); 233 md5sum_output_sum(md5sum);
232 return VO_TRUE; 234 return VO_TRUE;
233 } 235 }
234 } 236 }
235 237