// to non-I frames).
int use_opencl;/* 0 is disable use of opencl. 1 is enable use of opencl */
int use_hwd;
+ int use_decomb;
+ int use_detelecine;
#ifdef __LIBHB__
/* Internal data */
#ifdef USE_OPENCL
int use_dxva;
+ int use_decomb;
+ int use_detelecine;
hb_oclscale_t * os; //ocl scaler handler
#endif
struct SwsContext * context;
pv->height_out = init->height;
#ifdef USE_OPENCL
pv->use_dxva = init->use_dxva;
+ pv->use_decomb = init->job->use_decomb;
+ pv->use_detelecine = init->job->use_detelecine;
if ( pv->job->use_opencl )
{
#ifdef USE_OPENCL
if ( (in->f.fmt == pv->pix_fmt_out &&
!pv->crop[0] && !pv->crop[1] && !pv->crop[2] && !pv->crop[3] &&
- in->f.width == pv->width_out && in->f.height == pv->height_out) ||
+ in->f.width == pv->width_out && in->f.height == pv->height_out) &&
+ (pv->use_decomb == 0) && (pv->use_detelecine == 0) ||
(pv->use_dxva && in->f.width == pv->width_out && in->f.height == pv->height_out) )
{
*buf_out = in;
hb_buffer_t *buf;
int ww, hh;
- if( (w > pv->job->width || h > pv->job->height) && (pv->job->use_opencl) )
+ if( (w > pv->job->width || h > pv->job->height) && (pv->job->use_opencl) && (pv->job->use_decomb == 0) && (pv->job->use_detelecine == 0) )
{
buf = hb_video_buffer_init( pv->job->width, pv->job->height );
ww = pv->job->width;
{
pv->dst_frame = malloc( ww * hh * 3 / 2 );
}
- if( hb_va_extract( pv->dxva2, pv->dst_frame, frame, pv->job->width, pv->job->height, pv->job->title->crop, pv->os, pv->job->use_opencl ) == HB_WORK_ERROR )
+ if( hb_va_extract( pv->dxva2, pv->dst_frame, frame, pv->job->width, pv->job->height, pv->job->title->crop, pv->os, pv->job->use_opencl, pv->job->use_decomb, pv->job->use_detelecine ) == HB_WORK_ERROR )
{
hb_log( "hb_va_Extract failed!!!!!!" );
}
uint8_t *bufi2 = userdata[5];
int p = (int)userdata[6];
+ int decomb = (int)userdata[7];
+ int detelecine = (int)userdata[8];
int i;
if( hb_init_nv12toyuv_ocl( kenv, w, h, dxva2 ) )
return -1;
size_t gdim[2] = {w>>1, h>>1};
OCLCHECK( clEnqueueNDRangeKernel, kenv->command_queue, kenv->kernel, 2, NULL, gdim, NULL, 0, NULL, NULL );
- if( crop[0] || crop[1] || crop[2] || crop[3] )
+ if( (crop[0] || crop[1] || crop[2] || crop[3]) && (decomb == 0) && (detelecine == 0) )
{
AVPicture pic_in;
AVPicture pic_crop;
* nv12 to yuv interface
* bufi is input frame of nv12, w is input frame width, h is input frame height
*/
-int hb_ocl_nv12toyuv( uint8_t *bufi[], int p, int w, int h, int *crop, hb_va_dxva2_t *dxva2 )
+int hb_ocl_nv12toyuv( uint8_t *bufi[], int p, int w, int h, int *crop, hb_va_dxva2_t *dxva2, int decomb, int detelecine )
{
- void *userdata[7];
+ void *userdata[9];
userdata[0] = (void*)w;
userdata[1] = (void*)h;
userdata[2] = bufi[0];
userdata[4] = dxva2;
userdata[5] = bufi[1];
userdata[6] = (void*)p;
+ userdata[7] = decomb;
+ userdata[8] = detelecine;
if( hb_nv12toyuv_reg_kernel() )
return -1;
if( hb_run_kernel( "nv12toyuv", userdata ) )
* bufi is input frame of nv12, w is input frame width, h is input frame height
*/
#ifdef USE_HWD
-int hb_ocl_nv12toyuv( uint8_t *bufi[], int p, int w, int h, int *crop, hb_va_dxva2_t *dxva2 );
+int hb_ocl_nv12toyuv( uint8_t *bufi[], int p, int w, int h, int *crop, hb_va_dxva2_t *dxva2, int decomb, int detelecine );
#endif
#endif
#endif
* nv12 to yuv with opencl and with C reference
* scale with opencl
*/
-int hb_va_extract( hb_va_dxva2_t *dxva2, uint8_t *dst, AVFrame *frame, int job_w, int job_h, int *crop, hb_oclscale_t *os, int use_opencl )
+int hb_va_extract( hb_va_dxva2_t *dxva2, uint8_t *dst, AVFrame *frame, int job_w, int job_h, int *crop, hb_oclscale_t *os, int use_opencl, int use_decomb, int use_detelecine )
{
LPDIRECT3DSURFACE9 d3d = (LPDIRECT3DSURFACE9)(uintptr_t)frame->data[3];
#ifdef USE_OPENCL
if( ( dxva2->width > job_w || dxva2->height > job_h ) && (use_opencl))
{
- hb_ocl_nv12toyuv( plane, lock.Pitch, dxva2->width, dxva2->height, crop, dxva2 );
-
- static int init_flag = 0;
- if(init_flag == 0){
- scale_init( dxva2->width - crop[2] - crop[3], dxva2->height - crop[0] - crop[1], job_w, job_h );
- init_flag = 1;
- }
-
- hb_init_filter( dxva2->cl_mem_yuv, dxva2->width - crop[2] - crop[3], dxva2->height - crop[0] - crop[1], dst, job_w, job_h, crop );
+ hb_ocl_nv12toyuv( plane, lock.Pitch, dxva2->width, dxva2->height, crop, dxva2, use_decomb, use_detelecine );
+ if ( use_decomb || use_detelecine )
+ hb_read_opencl_buffer( dxva2->cl_mem_yuv, dst, dxva2->width*dxva2->height*3/2 );
+ else
+ {
+ static int init_flag = 0;
+ if(init_flag == 0)
+ {
+ scale_init( dxva2->width - crop[2] - crop[3], dxva2->height - crop[0] - crop[1], job_w, job_h );
+ init_flag = 1;
+ }
+
+ hb_init_filter( dxva2->cl_mem_yuv, dxva2->width - crop[2] - crop[3], dxva2->height - crop[0] - crop[1], dst, job_w, job_h, crop );
+ }
}
else
#endif
};
int hb_va_get_frame_buf( hb_va_dxva2_t *dxva2, AVCodecContext *p_context, AVFrame *frame );
-int hb_va_extract( hb_va_dxva2_t *dxva2, uint8_t *dst, AVFrame *frame, int job_w, int job_h, int *crop, hb_oclscale_t *os, int use_opencl );
+int hb_va_extract( hb_va_dxva2_t *dxva2, uint8_t *dst, AVFrame *frame, int job_w, int job_h, int *crop, hb_oclscale_t *os, int use_opencl, int use_decomb, int use_detelecine );
enum PixelFormat hb_ffmpeg_get_format( AVCodecContext *, const enum PixelFormat * );
hb_va_dxva2_t *hb_va_create_dxva2( hb_va_dxva2_t *dxva2, int codec_id );
void hb_va_new_dxva2( hb_va_dxva2_t *dxva2, AVCodecContext *p_context );
hb_filter_object_t * filter;
+ job->use_detelecine = detelecine;
+ job->use_decomb = decomb;
+
/* Add selected filters */
if( detelecine )
{