summaryrefslogtreecommitdiffstats
path: root/libhb/render.c
diff options
context:
space:
mode:
authorvan <[email protected]>2008-11-08 06:50:15 +0000
committervan <[email protected]>2008-11-08 06:50:15 +0000
commitfa63e466c782f2d803cd800148fdfd266d26bfe7 (patch)
tree52bbc3e91f3ed43ee536c46ca54660a04aedb086 /libhb/render.c
parent89eef8d080649cc44a1abc7ed0a0248c6976951d (diff)
Correct chroma size for raw video frames - width & height need to be rounded up if they're odd before dividing by 2.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1905 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/render.c')
-rw-r--r--libhb/render.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libhb/render.c b/libhb/render.c
index 7900ba2ae..5ca6a4c8d 100644
--- a/libhb/render.c
+++ b/libhb/render.c
@@ -55,13 +55,13 @@ hb_work_object_t hb_render =
*/
static uint8_t *getU(uint8_t *data, int width, int height, int x, int y)
{
- return(&data[(((y/2) * (width/2)) + (x/2)) + (width*height)]);
+ return(&data[(y>>1) * ((width+1)>>1) + (x>>1) + width*height]);
}
static uint8_t *getV(uint8_t *data, int width, int height, int x, int y)
{
- return(&data[(((y/2) * (width/2)) + (x/2)) + (width*height) +
- (width*height)/4]);
+ int w2 = (width+1) >> 1, h2 = (height+1) >> 1;
+ return(&data[(y>>1) * w2 + (x>>1) + width*height + w2*h2]);
}
static void ApplySub( hb_job_t * job, hb_buffer_t * buf,
@@ -248,7 +248,7 @@ int renderWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
}
/* Setup render buffer */
- hb_buffer_t * buf_render = hb_buffer_init( 3 * job->width * job->height / 2 );
+ hb_buffer_t * buf_render = hb_video_buffer_init( job->width, job->height );
/* Apply filters */
if( job->filters )