Пример #1
0
void VaapiDPBManager::execPictureRefsModification(const PicturePtr& picture,
                                                  const SliceHeaderPtr& sliceHdr)
{
    /* refPicList0 */
    if (!H264_IS_I_SLICE(sliceHdr) && !H264_IS_SI_SLICE(sliceHdr) &&
        sliceHdr->ref_pic_list_modification_flag_l0)
        execPictureRefsModification1(picture, sliceHdr, 0);

    /* refPicList1 */
    if (H264_IS_B_SLICE(sliceHdr) &&
        sliceHdr->ref_pic_list_modification_flag_l1)
        execPictureRefsModification1(picture, sliceHdr, 1);
}
bool VaapiDecoderH264::fillRefPicList(VaapiSliceH264 * slice)
{
    uint32_t i, numRefLists = 0;
    VaapiDecPicBufLayer *DPBLayer = m_DPBManager->DPBLayer;
    H264SliceHdr *const sliceHdr = &slice->m_sliceHdr;
    VaapiBufObject *sliceParamObj = slice->m_param;
    VASliceParameterBufferH264 *sliceParam =
        (VASliceParameterBufferH264 *) sliceParamObj->map();

    sliceParam->num_ref_idx_l0_active_minus1 = 0;
    sliceParam->num_ref_idx_l1_active_minus1 = 0;

    if (H264_IS_B_SLICE(sliceHdr))
        numRefLists = 2;
    else if (H264_IS_I_SLICE(sliceHdr))
        numRefLists = 0;
    else
        numRefLists = 1;

    if (numRefLists < 1)
        goto out;

    sliceParam->num_ref_idx_l0_active_minus1 =
        sliceHdr->num_ref_idx_l0_active_minus1;

    for (i = 0;
         i < DPBLayer->refPicList0Count && DPBLayer->refPicList0[i]; i++)
        vaapiFillPicture(&sliceParam->RefPicList0[i],
                         DPBLayer->refPicList0[i], 0);
    for (; i <= sliceParam->num_ref_idx_l0_active_minus1; i++)
        vaapiInitPicture(&sliceParam->RefPicList0[i]);

    if (numRefLists < 2)
        goto out;

    sliceParam->num_ref_idx_l1_active_minus1 =
        sliceHdr->num_ref_idx_l1_active_minus1;

    for (i = 0;
         i < DPBLayer->refPicList1Count && DPBLayer->refPicList1[i]; i++)
        vaapiFillPicture(&sliceParam->RefPicList1[i],
                         DPBLayer->refPicList1[i], 0);
    for (; i <= sliceParam->num_ref_idx_l1_active_minus1; i++)
        vaapiInitPicture(&sliceParam->RefPicList1[i]);

  out:
    sliceParamObj->unmap();
    return true;
}