hb_detect_comb() could crash because the dimensions of the video buffer
don't have to match the dimensions returned by work object info() method
if the video has segments of differeing resolutions.
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.9.x@4814
b64f7644-9d1e-0410-96f1-
a4d463321fa5
* @param prog_diff Sensitivity for detecting different colors on progressive frames
* @param prog_threshold Sensitivity for flagging progressive frames as combed
*/
-int hb_detect_comb( hb_buffer_t * buf, int width, int height, int color_equal, int color_diff, int threshold, int prog_equal, int prog_diff, int prog_threshold )
+int hb_detect_comb( hb_buffer_t * buf, int color_equal, int color_diff, int threshold, int prog_equal, int prog_diff, int prog_threshold )
{
+ int width = buf->width;
+ int height = buf->height;
int j, k, n, off, cc_1, cc_2, cc[3];
// int flag[3] ; // debugging flag
uint16_t s1, s2, s3, s4;
/* hb_detect_comb()
Analyze a frame for interlacing artifacts, returns true if they're found.
Taken from Thomas Oestreich's 32detect filter in the Transcode project. */
-int hb_detect_comb( hb_buffer_t * buf, int width, int height, int color_equal, int color_diff, int threshold, int prog_equal, int prog_diff, int prog_threshold );
+int hb_detect_comb( hb_buffer_t * buf, int color_equal, int color_diff, int threshold, int prog_equal, int prog_diff, int prog_threshold );
void hb_get_preview_by_index( hb_handle_t *, int, int, uint8_t * );
void hb_get_preview( hb_handle_t *, hb_title_t *, int,
// if we do "/2". The code here matches the calculation for
// PIX_FMT_YUV420P in ffmpeg's avpicture_fill() which is required
// for most of HB's filters to work right.
- return hb_buffer_init( width * height + ( ( width+1 ) >> 1 ) *
- ( ( height+1 ) >> 1 ) * 2 );
+ hb_buffer_t * b = hb_buffer_init( width * height + ( ( width+1 ) >> 1 ) *
+ ( ( height+1 ) >> 1 ) * 2 );
+ b->width = width;
+ b->height = height;
+
+ return b;
}
// this routine 'moves' data from src to dst by interchanging 'data',
}
/* Check preview for interlacing artifacts */
- if( hb_detect_comb( vid_buf, vid_info.width, vid_info.height, 10, 30, 9, 10, 30, 9 ) )
+ if( hb_detect_comb( vid_buf, 10, 30, 9, 10, 30, 9 ) )
{
hb_deep_log( 2, "Interlacing detected in preview frame %i", i+1);
interlaced_preview_count++;