zimg

zscale=t=linear:npl=400

(gdb) p *src_format
$27 = {version = 515, width = 3840, height = 2160, pixel_type = ZIMG_PIXEL_WORD, subsample_w = 1, subsample_h = 1, color_family = ZIMG_COLOR_YUV, matrix_coefficients = ZIMG_MATRIX_BT2020_NCL, transfer_characteristics = ZIMG_TRANSFER_ST2084, color_primaries = ZIMG_PRIMARIES_BT2020, depth = 10, pixel_range = ZIMG_RANGE_LIMITED, field_parity = ZIMG_FIELD_PROGRESSIVE,
chroma_location = ZIMG_CHROMA_LEFT, active_region = {left = nan(0x8000000000000), top = nan(0x8000000000000), width = nan(0x8000000000000), height = nan(0x8000000000000)}}
(gdb) p *dst_format
$28 = {version = 515, width = 3840, height = 2160, pixel_type = ZIMG_PIXEL_FLOAT, subsample_w = 0, subsample_h = 0, color_family = ZIMG_COLOR_RGB, matrix_coefficients = ZIMG_MATRIX_RGB, transfer_characteristics = ZIMG_TRANSFER_LINEAR, color_primaries = ZIMG_PRIMARIES_BT2020, depth = 32, pixel_range = ZIMG_RANGE_FULL, field_parity = ZIMG_FIELD_PROGRESSIVE,
chroma_location = ZIMG_CHROMA_LEFT, active_region = {left = nan(0x8000000000000), top = nan(0x8000000000000), width = nan(0x8000000000000), height = nan(0x8000000000000)}}

(gdb) p src[0] src[1] src[2]
$31 = {m_data = 0x7f07885e6540, m_stride = 7680, m_mask = 4294967295} //sizeof(ushort) * 3840
$32 = {m_data = 0x7f07895d65c0, m_stride = 3840, m_mask = 4294967295}
$33 = {m_data = 0x7f07899d2640, m_stride = 3840, m_mask = 4294967295}


(gdb) p dst[0] dst[1] dst[2]
$34 = {m_data = 0x7f074885a040, m_stride = 15360, m_mask = 4294967295}   //sizeof(float) * 3840 
$35 = {m_data = 0x7f074c81c040, m_stride = 15360, m_mask = 4294967295}   //sizeof(float) * 3840
$36 = {m_data = 0x7f074a83b040, m_stride = 15360, m_mask = 4294967295}   //sizeof(float) * 3840

1. YUV  -> float

 

2. resize_v

   

void resize_line_v_f32_c(const FilterContext &filter, const graph::ImageBuffer<const float> &src, const graph::ImageBuffer<float> &dst, unsigned i, unsigned left, unsigned right)
{
    const float *filter_coeffs = &filter.data[i * filter.stride];
    unsigned top = filter.left[i];

    for (unsigned j = left; j < right; ++j) {
        float accum = 0;

        for (unsigned k = 0; k < filter.filter_width; ++k) {
            float coeff = filter_coeffs[k];
            float x = src[top + k][j];

            accum += coeff * x;
        }

        dst[i][j] = accum;
    }
}

-vf scale=1280x720,
zscale=t=linear:npl=400,                format=gbrpf32le,               zscale=p=bt709,            tmap= ,           zscale=t=bt709:m=bt709:r=tv 
-c:v libyhevc -g 90 -keyint_min 90 -r 30 -vsync 1 -b:v 20m -preset fast -y

使用zimg 将yuv转换为rgb

-vf zscale=t=linear:npl=400,format=gbrpf32le,zscale=t=bt601,format=bgr24  images/%06d.bmp

原文地址:https://www.cnblogs.com/luoyinjie/p/14680498.html