It may be used under the terms of the GNU General Public License. */
#include "hb.h"
-
-#include "libavcodec/avcodec.h"
-#include "libswscale/swscale.h"
+#include "hbffmpeg.h"
struct hb_work_private_s
{
*/
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,
}
/* 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 )
/* Pop the frame's subtitle and dispose of it. */
hb_buffer_t * subtitles = hb_fifo_get( pv->subtitle_queue );
hb_buffer_close( &subtitles );
-
buf_tmp_in = NULL;
break;
}
if( job->vfr )
{
- if( hb_fifo_size( pv->delay_queue ) >= 3 )
+ if( hb_fifo_size( pv->delay_queue ) >= 4 )
{
*buf_out = hb_fifo_get( pv->delay_queue );
}
w->private_data = pv;
uint32_t swsflags;
- swsflags = SWS_LANCZOS;
-#ifndef __x86_64__
- swsflags |= SWS_ACCURATE_RND;
-#endif /* __x86_64__ */
+ swsflags = SWS_LANCZOS | SWS_ACCURATE_RND;
/* Get title and title size */
hb_title_t * title = job->title;