_ab-av1() {
    local i cur prev opts cmd
    COMPREPLY=()
    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
        cur="$2"
    else
        cur="${COMP_WORDS[COMP_CWORD]}"
    fi
    prev="$3"
    cmd=""
    opts=""

    for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
    do
        case "${cmd},${i}" in
            ",$1")
                cmd="ab__av1"
                ;;
            ab__av1,auto-encode)
                cmd="ab__av1__auto__encode"
                ;;
            ab__av1,crf-search)
                cmd="ab__av1__crf__search"
                ;;
            ab__av1,encode)
                cmd="ab__av1__encode"
                ;;
            ab__av1,help)
                cmd="ab__av1__help"
                ;;
            ab__av1,print-completions)
                cmd="ab__av1__print__completions"
                ;;
            ab__av1,sample-encode)
                cmd="ab__av1__sample__encode"
                ;;
            ab__av1,vmaf)
                cmd="ab__av1__vmaf"
                ;;
            ab__av1,xpsnr)
                cmd="ab__av1__xpsnr"
                ;;
            ab__av1__help,auto-encode)
                cmd="ab__av1__help__auto__encode"
                ;;
            ab__av1__help,crf-search)
                cmd="ab__av1__help__crf__search"
                ;;
            ab__av1__help,encode)
                cmd="ab__av1__help__encode"
                ;;
            ab__av1__help,help)
                cmd="ab__av1__help__help"
                ;;
            ab__av1__help,print-completions)
                cmd="ab__av1__help__print__completions"
                ;;
            ab__av1__help,sample-encode)
                cmd="ab__av1__help__sample__encode"
                ;;
            ab__av1__help,vmaf)
                cmd="ab__av1__help__vmaf"
                ;;
            ab__av1__help,xpsnr)
                cmd="ab__av1__help__xpsnr"
                ;;
            *)
                ;;
        esac
    done

    case "${cmd}" in
        ab__av1)
            opts="-h -V --help --version sample-encode vmaf xpsnr encode crf-search auto-encode print-completions help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__auto__encode)
            opts="-e -i -v -q -o -h --encoder --input --vfilter --pix-format --preset --keyint --scd --svt --enc --enc-input --min-vmaf --min-xpsnr --max-encoded-percent --min-crf --max-crf --thorough --crf-increment --cache --samples --sample-every --min-samples --sample-duration --keep --temp-dir --vmaf --vmaf-scale --vmaf-fps --reference-vfilter --xpsnr-fps --verbose --quiet --output --acodec --downmix-to-stereo --video-only --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --encoder)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -e)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --input)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                -i)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                --vfilter)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --pix-format)
                    COMPREPLY=($(compgen -W "yuv420p yuv420p10le yuv422p10le yuv444p10le" -- "${cur}"))
                    return 0
                    ;;
                --preset)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --keyint)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --scd)
                    COMPREPLY=($(compgen -W "true false" -- "${cur}"))
                    return 0
                    ;;
                --svt)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --enc)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --enc-input)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --min-vmaf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --min-xpsnr)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-encoded-percent)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --min-crf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-crf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --crf-increment)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --cache)
                    COMPREPLY=($(compgen -W "true false" -- "${cur}"))
                    return 0
                    ;;
                --samples)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sample-every)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --min-samples)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sample-duration)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --temp-dir)
                    COMPREPLY=()
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o plusdirs
                    fi
                    return 0
                    ;;
                --vmaf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --vmaf-scale)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --vmaf-fps)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --reference-vfilter)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --xpsnr-fps)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --output)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                -o)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                --acodec)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__crf__search)
            opts="-e -i -v -q -h --encoder --input --vfilter --pix-format --preset --keyint --scd --svt --enc --enc-input --min-vmaf --min-xpsnr --max-encoded-percent --min-crf --max-crf --thorough --crf-increment --cache --samples --sample-every --min-samples --sample-duration --keep --temp-dir --vmaf --vmaf-scale --vmaf-fps --reference-vfilter --xpsnr-fps --verbose --quiet --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --encoder)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -e)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --input)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                -i)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                --vfilter)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --pix-format)
                    COMPREPLY=($(compgen -W "yuv420p yuv420p10le yuv422p10le yuv444p10le" -- "${cur}"))
                    return 0
                    ;;
                --preset)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --keyint)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --scd)
                    COMPREPLY=($(compgen -W "true false" -- "${cur}"))
                    return 0
                    ;;
                --svt)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --enc)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --enc-input)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --min-vmaf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --min-xpsnr)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-encoded-percent)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --min-crf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --max-crf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --crf-increment)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --cache)
                    COMPREPLY=($(compgen -W "true false" -- "${cur}"))
                    return 0
                    ;;
                --samples)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sample-every)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --min-samples)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sample-duration)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --temp-dir)
                    COMPREPLY=()
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o plusdirs
                    fi
                    return 0
                    ;;
                --vmaf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --vmaf-scale)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --vmaf-fps)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --reference-vfilter)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --xpsnr-fps)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__encode)
            opts="-e -i -o -h --encoder --input --vfilter --pix-format --preset --keyint --scd --svt --enc --enc-input --crf --output --acodec --downmix-to-stereo --video-only --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --encoder)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -e)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --input)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                -i)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                --vfilter)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --pix-format)
                    COMPREPLY=($(compgen -W "yuv420p yuv420p10le yuv422p10le yuv444p10le" -- "${cur}"))
                    return 0
                    ;;
                --preset)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --keyint)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --scd)
                    COMPREPLY=($(compgen -W "true false" -- "${cur}"))
                    return 0
                    ;;
                --svt)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --enc)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --enc-input)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --crf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --output)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                -o)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                --acodec)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__help)
            opts="sample-encode vmaf xpsnr encode crf-search auto-encode print-completions help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__help__auto__encode)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__help__crf__search)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__help__encode)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__help__help)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__help__print__completions)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__help__sample__encode)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__help__vmaf)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__help__xpsnr)
            opts=""
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__print__completions)
            opts="-h --help bash elvish fish powershell zsh"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__sample__encode)
            opts="-e -i -h --encoder --input --vfilter --pix-format --preset --keyint --scd --svt --enc --enc-input --crf --samples --sample-every --min-samples --sample-duration --keep --temp-dir --cache --stdout-format --vmaf --vmaf-scale --vmaf-fps --reference-vfilter --xpsnr-fps --xpsnr --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --encoder)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -e)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --input)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                -i)
                    local oldifs
                    if [ -n "${IFS+x}" ]; then
                        oldifs="$IFS"
                    fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    if [ -n "${oldifs+x}" ]; then
                        IFS="$oldifs"
                    fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                --vfilter)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --pix-format)
                    COMPREPLY=($(compgen -W "yuv420p yuv420p10le yuv422p10le yuv444p10le" -- "${cur}"))
                    return 0
                    ;;
                --preset)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --keyint)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --scd)
                    COMPREPLY=($(compgen -W "true false" -- "${cur}"))
                    return 0
                    ;;
                --svt)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --enc)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --enc-input)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --crf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --samples)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sample-every)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --min-samples)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sample-duration)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --temp-dir)
                    COMPREPLY=()
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o plusdirs
                    fi
                    return 0
                    ;;
                --cache)
                    COMPREPLY=($(compgen -W "true false" -- "${cur}"))
                    return 0
                    ;;
                --stdout-format)
                    COMPREPLY=($(compgen -W "human json" -- "${cur}"))
                    return 0
                    ;;
                --vmaf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --vmaf-scale)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --vmaf-fps)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --reference-vfilter)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --xpsnr-fps)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__vmaf)
            opts="-h --reference --distorted --vmaf --vmaf-scale --vmaf-fps --reference-vfilter --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --reference)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --distorted)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --vmaf)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --vmaf-scale)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --vmaf-fps)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --reference-vfilter)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        ab__av1__xpsnr)
            opts="-h --reference --distorted --reference-vfilter --xpsnr-fps --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --reference)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --distorted)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --reference-vfilter)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --xpsnr-fps)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
    esac
}

if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then
    complete -F _ab-av1 -o nosort -o bashdefault -o default ab-av1
else
    complete -F _ab-av1 -o bashdefault -o default ab-av1
fi
