def call_vmafexec()

in python/vmaf/__init__.py [0:0]


    def call_vmafexec(reference, distorted, width, height, pixel_format, bitdepth,
                    float_psnr, psnr, float_ssim, ssim, float_ms_ssim, ms_ssim, float_moment,
                    no_prediction, models, subsample, n_threads, disable_avx, output, exe, logger,
                    vif_enhn_gain_limit=None, adm_enhn_gain_limit=None, motion_force_zero=False):

        if exe is None:
            exe = required(ExternalProgram.vmafexec)

        vmafexec_cmd = "{exe} --reference {reference} --distorted {distorted} --width {width} --height {height} " \
                     "--pixel_format {pixel_format} --bitdepth {bitdepth} --output {output}" \
            .format(
            exe=exe,
            reference=reference,
            distorted=distorted,
            width=width,
            height=height,
            pixel_format=pixel_format,
            bitdepth=bitdepth,
            output=output)

        if float_psnr:
            vmafexec_cmd += ' --feature float_psnr'
        if float_ssim:
            vmafexec_cmd += ' --feature float_ssim'
        if float_ms_ssim:
            vmafexec_cmd += ' --feature float_ms_ssim'
        if float_moment:
            vmafexec_cmd += ' --feature float_moment'

        if psnr:
            vmafexec_cmd += ' --feature psnr'
        if ssim:
            # vmafexec_cmd += ' --feature ssim'
            assert False, 'ssim (the daala integer ssim) is deprecated'
        if ms_ssim:
            vmafexec_cmd += ' --feature ms_ssim'

        if no_prediction:
            vmafexec_cmd += ' --no_prediction'
        else:
            assert models is not None
            assert isinstance(models, list)
            for model in models:
                vmafexec_cmd += ' --model {}'.format(model)

                # FIXME: hacky - since we do not know which feature is the one used in the model,
                # we have to set the parameter for all three, at the expense of extra computation.

                if vif_enhn_gain_limit is not None:
                    vmafexec_cmd += f':vif.vif_enhn_gain_limit={vif_enhn_gain_limit}:float_vif.vif_enhn_gain_limit={vif_enhn_gain_limit}'
                if adm_enhn_gain_limit is not None:
                    vmafexec_cmd += f':adm.adm_enhn_gain_limit={adm_enhn_gain_limit}:float_adm.adm_enhn_gain_limit={adm_enhn_gain_limit}'
                if motion_force_zero:
                    assert isinstance(motion_force_zero, bool)
                    motion_force_zero = str(motion_force_zero).lower()
                    vmafexec_cmd += f':motion.motion_force_zero={motion_force_zero}:float_motion.motion_force_zero={motion_force_zero}'

        assert isinstance(subsample, int) and subsample >= 1
        if subsample != 1:
            vmafexec_cmd += ' --subsample {}'.format(subsample)

        assert isinstance(n_threads, int) and n_threads >= 1
        if n_threads != 1:
            vmafexec_cmd += ' --threads {}'.format(n_threads)

        if disable_avx:
            vmafexec_cmd += ' --cpumask -1'

        if logger:
            logger.info(vmafexec_cmd)

        run_process(vmafexec_cmd, shell=True)