job->list_attachment = hb_attachment_list_copy( title->list_attachment );
job->metadata = hb_metadata_copy( title->metadata );
- job->use_hw_decode = 0;
}
static void job_clean( hb_job_t * job )
|| title->video_codec_param == AV_CODEC_ID_MPEG4 )
&& title->opaque_priv );
}
-int hb_get_gui_info(hb_gui_t * gui, int option)
-{
- if ( option == 1 )
- return gui->use_hwd;
- else if ( option == 2 )
- return gui->use_opencl;
- else
- return gui->title_scan;
-}
-void hb_set_gui_info(hb_gui_t *gui, int hwd, int opencl, int titlescan)
-{
- gui->use_hwd = hwd;
- gui->use_opencl = opencl;
- gui->title_scan = titlescan;
-}
+
int hb_subtitle_can_pass( int source, int mux );
hb_attachment_t *hb_attachment_copy(const hb_attachment_t *src);
-int hb_get_gui_info(hb_gui_t *gui, int option);
-void hb_set_gui_info(hb_gui_t *gui, int hwd, int opencl, int titlescan);
-struct hb_gui_s
-{
- int use_hwd;
- int use_opencl;
- int title_scan;
-};
-hb_gui_t hb_gui;
+int hb_gui_use_hwd_flag;
hb_list_t *hb_attachment_list_copy(const hb_list_t *src);
void hb_attachment_close(hb_attachment_t **attachment);
// to non-I frames).
int use_opencl;/* 0 is disable use of opencl. 1 is enable use of opencl */
int use_hwd;
- int use_hw_decode;
#ifdef __LIBHB__
/* Internal data */
extern hb_work_object_t hb_encca_haac;
extern hb_work_object_t hb_encavcodeca;
extern hb_work_object_t hb_reader;
-extern hb_work_object_t hb_decavcodecv_accl;
#define HB_FILTER_OK 0
#define HB_FILTER_DELAY 1
struct hb_filter_private_s
{
+ hb_job_t * job;
int width_in;
int height_in;
int pix_fmt;
hb_filter_private_t * pv = filter->private_data;
// TODO: add pix format option to settings
+ pv->job = init->job;
pv->pix_fmt_out = init->pix_fmt;
pv->width_in = init->width;
pv->height_in = init->height;
pv->height_out = init->height;
#ifdef USE_OPENCL
pv->use_dxva = init->use_dxva;
- if ( hb_get_gui_info(&hb_gui, 2) )
+
+ if ( pv->job->use_opencl )
{
pv->title_width = init->title_width;
pv->title_height = init->title_height;
memcpy( info->out.crop, pv->crop, sizeof( int[4] ) );
#ifdef USE_OPENCL
- if ( hb_get_gui_info(&hb_gui, 2) )
+
+ if ( pv->job->use_opencl )
{
int cropped_width = pv->title_width - ( pv->crop[2] + pv->crop[3] );
int cropped_height = pv->title_height - ( pv->crop[0] + pv->crop[1] );
return;
}
#ifdef USE_OPENCL
- if ( hb_get_gui_info(&hb_gui, 2) && pv->os)
+
+ if ( pv->job->use_opencl && pv->os )
{
CL_FREE( pv->os->h_in_buf );
CL_FREE( pv->os->h_out_buf );
pv->crop[0], pv->crop[2] );
#ifdef USE_OPENCL
- if ( hb_get_gui_info(&hb_gui, 2) )
+
+ if ( pv->job->use_opencl )
{
int w = in->f.width - ( pv->crop[2] + pv->crop[3] );
int h = in->f.height - ( pv->crop[0] + pv->crop[1] );
#include "hb.h"
#include "hbffmpeg.h"
-#include "audio_remap.h"
#include "audio_resample.h"
#ifdef USE_HWD
{
hb_buffer_t *buf;
int ww, hh;
- if( (w > pv->job->width || h > pv->job->height) && (hb_get_gui_info(&hb_gui, 2) == 1) )
+
+ if( (w > pv->job->width || h > pv->job->height) && (pv->job->use_opencl) )
{
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 ) == 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 ) == HB_WORK_ERROR )
{
hb_log( "hb_va_Extract failed!!!!!!" );
}
|| (w->codec_param==AV_CODEC_ID_VC1)
|| (w->codec_param==AV_CODEC_ID_WMV3)
|| (w->codec_param==AV_CODEC_ID_MPEG4))
- && pv->job && job->use_hw_decode)
+ && pv->job && job->use_hwd && hb_use_dxva( pv->title ) )
{
pv->dxva2 = hb_va_create_dxva2( pv->dxva2, w->codec_param );
if( pv->dxva2 && pv->dxva2->do_job==HB_WORK_OK )
.info = decavcodecvInfo,
.bsinfo = decavcodecvBSInfo
};
-#ifdef USE_HWD
-hb_work_object_t hb_decavcodecv_accl =
-{
- .id = WORK_DECAVCODECVACCL,
- .name = "Video hardware decoder (libavcodec)",
- .init = decavcodecvInit,
- .work = decavcodecvWork,
- .close = decavcodecClose,
- .flush = decavcodecvFlush,
- .info = decavcodecvInfo,
- .bsinfo = decavcodecvBSInfo
-};
-#endif
static void decodeAudio(hb_audio_t *audio, hb_work_private_t *pv, uint8_t *data,
int size, int64_t pts)
{
#endif
hb_register( &hb_encavcodeca );
hb_register( &hb_reader );
-#ifdef USE_HWD
- hb_register( &hb_decavcodecv_accl );
-#endif
return h;
}
#endif
hb_register( &hb_encavcodeca );
hb_register( &hb_reader );
-#ifdef USE_HWD
- hb_register( &hb_decavcodecv_accl );
-#endif
return h;
}
WORK_ENCAVCODEC_AUDIO,
WORK_MUX,
WORK_READER,
- WORK_DECPGSSUB,
- WORK_DECAVCODECVACCL
+ WORK_DECPGSSUB
};
extern hb_filter_object_t hb_filter_detelecine;
#include <stdio.h>\r
#include <stdlib.h>\r
#include <string.h>\r
-#include <windows.h>\r
#include "openclwrapper.h"\r
#include "openclkernels.h"\r
\r
//#define USE_EXTERNAL_KERNEL\r
+#ifdef SYS_MINGW\r
+#include <windows.h>\r
+#endif\r
\r
#if defined(__APPLE__)\r
#include <OpenCL/cl.h>\r
CL_QUEUE_THREAD_HANDLE_AMD, sizeof(handle),\r
&handle, NULL ) == CL_SUCCESS && handle != INVALID_HANDLE_VALUE )\r
{\r
+#ifdef SYS_MINGW \r
SetThreadPriority( handle, THREAD_PRIORITY_TIME_CRITICAL );\r
+#endif\r
}\r
\r
return 0;\r
#include <math.h>\r
#include <stdio.h>\r
#include <string.h>\r
-#include <windows.h>\r
#include <time.h>\r
#include "scale.h"\r
#include "openclwrapper.h"\r
if ( fread(buf, 1, sizeof(buf), stream->file_handle) == sizeof(buf) )
{
#ifdef USE_HWD
- if ( hb_get_gui_info(&hb_gui, 1) )
+ if ( hb_gui_use_hwd_flag == 1 )
return 0;
#endif
int psize;
* 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 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 )
{
LPDIRECT3DSURFACE9 d3d = (LPDIRECT3DSURFACE9)(uintptr_t)frame->data[3];
lock.Pitch,
};
#ifdef USE_OPENCL
- if( ( dxva2->width > job_w || dxva2->height > job_h ) && (TestGPU() == 0) && (hb_get_gui_info(&hb_gui, 2) == 1))
+ if( ( dxva2->width > job_w || dxva2->height > job_h ) && (TestGPU() == 0) && (use_opencl))
{
hb_ocl_nv12toyuv( plane, lock.Pitch, dxva2->width, dxva2->height, crop, dxva2 );
};
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 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 );
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 );
title->video_codec_param = AV_CODEC_ID_MPEG2VIDEO;
}
#endif
-#ifdef USE_HWD
- if ( /*job->use_opencl &&*/ hb_use_dxva( title ) && job->use_hwd )
- {
- //vcodec = WORK_DECAVCODECVACCL;
- job->use_hw_decode = 1;
- }
-#endif
+
hb_list_add( job->list_work, ( w = hb_get_work( vcodec ) ) );
w->codec_param = title->video_codec_param;
w->fifo_in = job->fifo_mpeg2;
titleindex = 0;
}
- hb_set_gui_info(&hb_gui, use_hwd, use_opencl, titleindex);
+ hb_gui_use_hwd_flag = use_hwd;
hb_scan( h, input, titleindex, preview_count, store_previews, min_title_duration * 90000LL );
/* Wait... */