[vlc-commits] png: encoder: fix row offset calculation
Tristan Matthews
git at videolan.org
Sun Apr 27 21:54:47 CEST 2014
vlc | branch: master | Tristan Matthews <le.businessman at gmail.com> | Sun Apr 27 15:45:55 2014 -0400| [58e4b45960f8d95e754ab9042a70f22965eb103e] | committer: Tristan Matthews
png: encoder: fix row offset calculation
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=58e4b45960f8d95e754ab9042a70f22965eb103e
---
modules/codec/png.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/modules/codec/png.c b/modules/codec/png.c
index 9d9f634..46d31af 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -393,12 +393,9 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
png_infop p_end_info = png_create_info_struct( p_png );
if( p_end_info == NULL ) goto error;
- const unsigned i_width = p_enc->fmt_in.video.i_visible_width;
- const unsigned i_height = p_enc->fmt_in.video.i_visible_height;
-
png_set_IHDR( p_png, p_info,
- i_width,
- i_height,
+ p_enc->fmt_in.video.i_visible_width,
+ p_enc->fmt_in.video.i_visible_height,
8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT );
if( p_sys->b_error ) goto error;
@@ -408,9 +405,9 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
/* Encode picture */
- for( unsigned i = 0; i < i_height; i++ )
+ for( int i = 0; i < p_pic->p->i_lines; i++ )
{
- png_write_row( p_png, p_pic->p->p_pixels + (i_width * i * 3));
+ png_write_row( p_png, p_pic->p->p_pixels + (i * p_pic->p->i_pitch) );
if( p_sys->b_error ) goto error;
}
More information about the vlc-commits
mailing list