• Archit Taneja's avatar
    [media] v4l: ti-vpe: Add de-interlacer support in VPE · 585e6f01
    Archit Taneja authored
    Add support for the de-interlacer block in VPE. For de-interlacer to
    work, we need to enable 2 more sets of VPE input ports which fetch data
    from the 'last' and 'last to last' fields of the interlaced video. Apart
    from that, we need to enable the Motion vector output and input ports,
    and also allocate DMA buffers for them.
    
    We need to make sure that two most recent fields in the source queue are
    available and in the 'READY' state. Once a mem2mem context gets access
    to the VPE HW(in device_run), it extracts the addresses of the 3
    buffers, and provides it to the data descriptors for the 3 sets of input
    ports((LUMA1, CHROMA1), (LUMA2, CHROMA2), and (LUMA3, CHROMA3))
    respectively for the 3 consecutive fields. The motion vector and output
    port descriptors are configured and the list is submitted to VPDMA.
    
    Once the transaction is done, the v4l2 buffer corresponding to the
    oldest field(the 3rd one) is changed to the state 'DONE', and the
    buffers corresponding to 1st and 2nd fields become the 2nd and 3rd field
    for the next de-interlace operation. This way, for each deinterlace
    operation, we have the 3 most recent fields. After each transaction, we
    also swap the motion vector buffers, the new input motion vector buffer
    contains the resultant motion information of all the previous frames,
    and the new output motion vector buffer will be used to hold the updated
    motion vector to capture the motion changes in the next field. The
    motion vector buffers are allocated using the DMA allocation API.
    
    The de-interlacer is removed from bypass mode, it requires some extra
    default configurations which are now added. The chrominance upsampler
    coefficients are added for interlaced frames. Some VPDMA parameters like
    frame start event and line mode are configured for the 2 extra sets of
    input ports.
    Signed-off-by: default avatarArchit Taneja <archit@ti.com>
    Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
    585e6f01
vpe.c 51.5 KB