예제 #1
0
int cl_init_loop_filter() {
    int err;

    char *lf_opts = vp8_cl_build_lf_compile_opts();
    if (lf_opts == NULL)
        return VP8_CL_TRIED_BUT_FAILED;
    
    // Create the filter compute program from the file-defined source code
    err = cl_load_program(&cl_data.loop_filter_program, loop_filter_cl_file_name, lf_opts);
    free(lf_opts); //Free before checking status to prevent memory leak in failure case.
    if (err != CL_SUCCESS) {
        return VP8_CL_TRIED_BUT_FAILED;
    }

    // Create the compute kernels in the program we wish to run
    VP8_CL_CREATE_KERNEL(cl_data,loop_filter_program,vp8_loop_filter_all_edges_kernel,"vp8_loop_filter_all_edges_kernel");
    VP8_CL_CALC_LOCAL_SIZE(cl_data.vp8_loop_filter_all_edges_kernel,&cl_data.vp8_loop_filter_all_edges_kernel_size);
    
    if (cl_data.vp8_loop_filter_all_edges_kernel_size < 16){
        VP8_CL_CREATE_KERNEL(cl_data,loop_filter_program,vp8_loop_filter_horizontal_edges_kernel,"vp8_loop_filter_horizontal_edges_kernel");
        VP8_CL_CREATE_KERNEL(cl_data,loop_filter_program,vp8_loop_filter_vertical_edges_kernel,"vp8_loop_filter_vertical_edges_kernel");
        VP8_CL_CALC_LOCAL_SIZE(cl_data.vp8_loop_filter_horizontal_edges_kernel,&cl_data.vp8_loop_filter_horizontal_edges_kernel_size);
        VP8_CL_CALC_LOCAL_SIZE(cl_data.vp8_loop_filter_vertical_edges_kernel,&cl_data.vp8_loop_filter_vertical_edges_kernel_size);
    } else {
        cl_data.vp8_loop_filter_horizontal_edges_kernel = NULL;
        cl_data.vp8_loop_filter_vertical_edges_kernel = NULL;
    }

    VP8_CL_CREATE_KERNEL(cl_data,loop_filter_program,vp8_loop_filter_simple_all_edges_kernel,"vp8_loop_filter_simple_all_edges_kernel");
    VP8_CL_CALC_LOCAL_SIZE(cl_data.vp8_loop_filter_simple_all_edges_kernel,&cl_data.vp8_loop_filter_simple_all_edges_kernel_size);
    
    if (cl_data.vp8_loop_filter_simple_all_edges_kernel_size < 16){
        VP8_CL_CREATE_KERNEL(cl_data,loop_filter_program,vp8_loop_filter_simple_horizontal_edges_kernel,"vp8_loop_filter_simple_horizontal_edges_kernel");
        VP8_CL_CREATE_KERNEL(cl_data,loop_filter_program,vp8_loop_filter_simple_vertical_edges_kernel,"vp8_loop_filter_simple_vertical_edges_kernel");
        VP8_CL_CALC_LOCAL_SIZE(cl_data.vp8_loop_filter_simple_horizontal_edges_kernel,&cl_data.vp8_loop_filter_simple_horizontal_edges_kernel_size);
        VP8_CL_CALC_LOCAL_SIZE(cl_data.vp8_loop_filter_simple_vertical_edges_kernel,&cl_data.vp8_loop_filter_simple_vertical_edges_kernel_size);
    } else {
        cl_data.vp8_loop_filter_simple_horizontal_edges_kernel = NULL;
        cl_data.vp8_loop_filter_simple_vertical_edges_kernel = NULL;
    }
    
    memset(&loop_mem, 0, sizeof(struct VP8_LOOP_MEM));
    block_offsets = NULL;
    priority_num_blocks = NULL;

    vp8_loop_filter_filters_init();

    return CL_SUCCESS;
}
예제 #2
0
int cl_init_dequant() {
    int err;

    //printf("Initializing dequant program/kernels\n");

    // Create the compute program from the file-defined source code
    if (cl_load_program(&cl_data.dequant_program, dequant_cl_file_name,
            dequantCompileOptions) != CL_SUCCESS)
        return VP8_CL_TRIED_BUT_FAILED;

    // Create the compute kernels in the program we wish to run
    VP8_CL_CREATE_KERNEL(cl_data,dequant_program,vp8_dequant_dc_idct_add_kernel,"vp8_dequant_dc_idct_add_kernel");
    VP8_CL_CREATE_KERNEL(cl_data,dequant_program,vp8_dequant_idct_add_kernel,"vp8_dequant_idct_add_kernel");
    VP8_CL_CREATE_KERNEL(cl_data,dequant_program,vp8_dequantize_b_kernel,"vp8_dequantize_b_kernel");

    //printf("Created dequant kernels\n");

    return CL_SUCCESS;
}