Beispiel #1
0
XCamReturn
SmartAnalyzer::analyze (SmartPtr<BufferProxy> &buffer)
{
    XCamReturn ret = XCAM_RETURN_NO_ERROR;
    X3aResultList results;

    if (!buffer.ptr ()) {
        XCAM_LOG_DEBUG ("SmartAnalyzer::analyze got NULL buffer!");
        return XCAM_RETURN_ERROR_PARAM;
    }

    SmartHandlerList::iterator i_handler = _handlers.begin ();
    for (; i_handler != _handlers.end ();  ++i_handler)
    {
        SmartPtr<SmartAnalysisHandler> handler = *i_handler;
        if (!handler->is_valid ())
            continue;

        ret = handler->analyze (buffer, results);
        if (ret != XCAM_RETURN_NO_ERROR && ret != XCAM_RETURN_BYPASS) {
            XCAM_LOG_WARNING ("smart analyzer analyze handler(%s) context failed", XCAM_STR(handler->get_name()));
            handler->destroy_context ();
        }
    }

    if (!results.empty ()) {
        set_results_timestamp (results, buffer->get_timestamp ());
        notify_calculation_done (results);
    }

    return XCAM_RETURN_NO_ERROR;
}
Beispiel #2
0
void
SmartAnalyzer::post_smart_results (X3aResultList &results, int64_t timestamp)
{
    if (!results.empty ()) {
        set_results_timestamp (results, timestamp);
        notify_calculation_done (results);
    }
}
Beispiel #3
0
XCamReturn
X3aAnalyzer::analyze_3a_statistics (SmartPtr<X3aStats> &stats)
{
    XCamReturn ret = XCAM_RETURN_NO_ERROR;
    X3aResultList results;

    ret = pre_3a_analyze (stats);
    if (ret != XCAM_RETURN_NO_ERROR) {
        notify_calculation_failed(
            NULL, stats->get_timestamp (), "ae calculation failed");
        return ret;
    }

    ret = _ae_handler->analyze (results);
    if (ret != XCAM_RETURN_NO_ERROR) {
        notify_calculation_failed(
            _ae_handler.ptr(), stats->get_timestamp (), "ae calculation failed");
        return ret;
    }

    ret = _awb_handler->analyze (results);
    if (ret != XCAM_RETURN_NO_ERROR) {
        notify_calculation_failed(
            _awb_handler.ptr(), stats->get_timestamp (), "awb calculation failed");
        return ret;
    }

    ret = _af_handler->analyze (results);
    if (ret != XCAM_RETURN_NO_ERROR) {
        notify_calculation_failed(
            _af_handler.ptr(), stats->get_timestamp (), "af calculation failed");
        return ret;
    }

    ret = _common_handler->analyze (results);
    if (ret != XCAM_RETURN_NO_ERROR) {
        notify_calculation_failed(
            _common_handler.ptr(), stats->get_timestamp (), "3a other calculation failed");
        return ret;
    }

    ret = post_3a_analyze (results);
    if (ret != XCAM_RETURN_NO_ERROR) {
        notify_calculation_failed(
            NULL, stats->get_timestamp (), "3a collect results failed");
        return ret;
    }

    if (!results.empty ())
        notify_calculation_done (results);

    return ret;

}
Beispiel #4
0
void
HybridAnalyzer::x3a_calculation_done (XAnalyzer *analyzer, X3aResultList &results)
{
    XCAM_UNUSED (analyzer);

    static XCam3aResultHead *res_heads[XCAM_3A_MAX_RESULT_COUNT];
    xcam_mem_clear (res_heads);
    XCAM_ASSERT (results.size () < XCAM_3A_MAX_RESULT_COUNT);

    uint32_t result_count = translate_3a_results_to_xcam (results,
                            res_heads, XCAM_3A_MAX_RESULT_COUNT);
    convert_results (res_heads, result_count, results);
    for (uint32_t i = 0; i < result_count; ++i) {
        if (res_heads[i])
            free_3a_result (res_heads[i]);
    }

    notify_calculation_done (results);
}
Beispiel #5
0
XCamReturn
X3aAnalyzerAiq::configure_3a ()
{
    XCamReturn ret = XCAM_RETURN_NO_ERROR;
    X3aResultList first_results;

    if (!_sensor_data_ready) {
        struct atomisp_sensor_mode_data sensor_mode_data;
        xcam_mem_clear (sensor_mode_data);
        XCAM_ASSERT (_isp.ptr());

        ret = _isp->get_sensor_mode_data (sensor_mode_data);
        XCAM_FAIL_RETURN (WARNING, ret == XCAM_RETURN_NO_ERROR, ret, "get sensor mode data failed");
        _sensor_mode_data = sensor_mode_data;
        _sensor_data_ready = true;
    }

    if (!_aiq_compositor->set_sensor_mode_data (&_sensor_mode_data)) {
        XCAM_LOG_WARNING ("AIQ configure 3a failed");
        return XCAM_RETURN_ERROR_AIQ;
    }

    XCAM_LOG_DEBUG ("X3aAnalyzerAiq got sensor mode data, coarse_time_min:%u, "
                    "coarse_time_max_margin:%u, "
                    "fine_time_min:%u, fine_time_max_margin:%u, "
                    "fine_time_def:%u, "
                    "frame_length_lines:%u, line_length_pck:%u, "
                    "vt_pix_clk_freq_mhz:%u, "
                    "crop_horizontal_start:%u, crop_vertical_start:%u, "
                    "crop_horizontal_end:%u, crop_vertical_end:%u, "
                    "output_width:%u, output_height:%u, "
                    "binning_factor_x:%u, binning_factor_y:%u",
                    _sensor_mode_data.coarse_integration_time_min,
                    _sensor_mode_data.coarse_integration_time_max_margin,
                    _sensor_mode_data.fine_integration_time_min,
                    _sensor_mode_data.fine_integration_time_max_margin,
                    _sensor_mode_data.fine_integration_time_def,
                    _sensor_mode_data.frame_length_lines,
                    _sensor_mode_data.line_length_pck,
                    _sensor_mode_data.vt_pix_clk_freq_mhz,
                    _sensor_mode_data.crop_horizontal_start,
                    _sensor_mode_data.crop_vertical_start,
                    _sensor_mode_data.crop_horizontal_end,
                    _sensor_mode_data.crop_vertical_end,
                    _sensor_mode_data.output_width,
                    _sensor_mode_data.output_height,
                    (uint32_t)_sensor_mode_data.binning_factor_x,
                    (uint32_t)_sensor_mode_data.binning_factor_y);

    // initialize ae and awb
    get_ae_handler ()->analyze (first_results);
    get_awb_handler ()->analyze (first_results);

    ret = _aiq_compositor->integrate (first_results);
    XCAM_FAIL_RETURN (WARNING, ret == XCAM_RETURN_NO_ERROR, ret, "AIQ configure_3a failed on integrate results");

    if (!first_results.empty()) {
        notify_calculation_done (first_results);
    }

    return XCAM_RETURN_NO_ERROR;
}