Commit b2f40814 authored by Loren Merritt's avatar Loren Merritt Committed by Fiona Glaser

Fix a crash in --dump-yuv for odd resolutions

parent 8c08475d
......@@ -92,6 +92,7 @@ typedef struct
void (*plane_copy_interleave)( pixel *dst, int i_dst,
uint8_t *srcu, int i_srcu,
uint8_t *srcv, int i_srcv, int w, int h );
/* may write up to 15 pixels off the end of each plane */
void (*plane_copy_deinterleave)( pixel *dstu, int i_dstu,
pixel *dstv, int i_dstv,
pixel *src, int i_src, int w, int h );
......
......@@ -77,10 +77,11 @@ static void x264_frame_dump( x264_t *h )
fwrite( &h->fdec->plane[0][y*h->fdec->i_stride[0]], sizeof(pixel), h->param.i_width, f );
int cw = h->param.i_width>>1;
int ch = h->param.i_height>>1;
pixel *planeu = x264_malloc( cw*ch*2*sizeof(pixel) );
pixel *planev = planeu + cw*ch;
pixel *planeu = x264_malloc( (cw*ch*2+32)*sizeof(pixel) );
pixel *planev = planeu + cw*ch + 16;
h->mc.plane_copy_deinterleave( planeu, cw, planev, cw, h->fdec->plane[1], h->fdec->i_stride[1], cw, ch );
fwrite( planeu, 1, cw*ch*2*sizeof(pixel), f );
fwrite( planeu, 1, cw*ch*sizeof(pixel), f );
fwrite( planev, 1, cw*ch*sizeof(pixel), f );
x264_free( planeu );
fclose( f );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment