vlc | branch: master | Filip Roséen <fi...@atch.se> | Thu Oct 13 18:06:57 2016 +0200| [e768953aedcb2e1d786df0fdb3e5450ecdfbfa63] | committer: Jean-Baptiste Kempf
codec/sdl_image: narrow scope of variales used in loop Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e768953aedcb2e1d786df0fdb3e5450ecdfbfa63 --- modules/codec/sdl_image.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/modules/codec/sdl_image.c b/modules/codec/sdl_image.c index ae09181..40cce2c 100644 --- a/modules/codec/sdl_image.c +++ b/modules/codec/sdl_image.c @@ -186,14 +186,13 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) { case 8: { - uint8_t *p_src, *p_dst; - uint8_t r, g, b; for ( int i = 0; i < p_surface->h; i++ ) { - p_src = (uint8_t*)p_surface->pixels + i * p_surface->pitch; - p_dst = p_pic->p[0].p_pixels + i * p_pic->p[0].i_pitch; + uint8_t *p_src = (uint8_t*)p_surface->pixels + i * p_surface->pitch; + uint8_t *p_dst = p_pic->p[0].p_pixels + i * p_pic->p[0].i_pitch; for ( int j = 0; j < p_surface->w; j++ ) { + uint8_t r, g, b; SDL_GetRGB( *(p_src++), p_surface->format, &r, &g, &b ); *(p_dst++) = r; @@ -220,14 +219,13 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) } case 24: { - uint8_t *p_src, *p_dst; - uint8_t r, g, b; for ( int i = 0; i < p_surface->h; i++ ) { - p_src = (uint8_t*)p_surface->pixels + i * p_surface->pitch; - p_dst = p_pic->p[0].p_pixels + i * p_pic->p[0].i_pitch; + uint8_t *p_src = (uint8_t*)p_surface->pixels + i * p_surface->pitch; + uint8_t *p_dst = p_pic->p[0].p_pixels + i * p_pic->p[0].i_pitch; for ( int j = 0; j < p_surface->w; j++ ) { + uint8_t r, g, b; SDL_GetRGB( *(uint32_t*)p_src, p_surface->format, &r, &g, &b ); *(p_dst++) = r; @@ -240,14 +238,13 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) } case 32: { - uint8_t *p_src, *p_dst; - uint8_t r, g, b, a; for ( int i = 0; i < p_surface->h; i++ ) { - p_src = (uint8_t*)p_surface->pixels + i * p_surface->pitch; - p_dst = p_pic->p[0].p_pixels + i * p_pic->p[0].i_pitch; + uint8_t *p_src = (uint8_t*)p_surface->pixels + i * p_surface->pitch; + uint8_t *p_dst = p_pic->p[0].p_pixels + i * p_pic->p[0].i_pitch; for ( int j = 0; j < p_surface->w; j++ ) { + uint8_t r, g, b, a; SDL_GetRGBA( *(uint32_t*)p_src, p_surface->format, &r, &g, &b, &a ); *(p_dst++) = b; _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits