- if( j - last_nonb <= 1 )
- {
- int cost2p1 = x264_slicetype_frame_cost( h, &a, frames, last_nonb+0, j+1, j+1, 1 );
- if( frames[j+1]->i_intra_mbs[2] > i_mb_count / 2 )
- {
- frames[j]->i_type = X264_TYPE_P;
- continue;
- }
-
-#if HAVE_OPENCL
- if( h->param.b_opencl )
- {
- int b_work_done = 0;
- b_work_done |= x264_opencl_precalculate_frame_cost(h, frames, a.i_lambda, last_nonb+0, j+1, j+0 );
- b_work_done |= x264_opencl_precalculate_frame_cost(h, frames, a.i_lambda, last_nonb+0, j+0, j+0 );
- b_work_done |= x264_opencl_precalculate_frame_cost(h, frames, a.i_lambda, last_nonb+1, j+1, j+1 );
- if( b_work_done )
- x264_opencl_flush( h );
- }
-#endif
-
- int cost1b1 = x264_slicetype_frame_cost( h, &a, frames, last_nonb+0, j+1, j+0, 0 );
- int cost1p0 = x264_slicetype_frame_cost( h, &a, frames, last_nonb+0, j+0, j+0, 0 );
- int cost2p0 = x264_slicetype_frame_cost( h, &a, frames, last_nonb+1, j+1, j+1, 0 );
+ int bframes = j - last_nonb - 1;
+ memset( path, 'B', bframes );
+ strcpy( path+bframes, "PP" );
+ int cost_p = x264_slicetype_path_cost( h, &a, frames+last_nonb, path, COST_MAX );
+ strcpy( path+bframes, "BP" );
+ int cost_b = x264_slicetype_path_cost( h, &a, frames+last_nonb, path, cost_p );