/* Fill in Reference List Entries (Gen5+: ILK, SNB, IVB) */
void
gen5_fill_avc_ref_idx_state(
    uint8_t             state[32],
    const VAPictureH264 ref_list[32],
    unsigned int        ref_list_count,
    const GenFrameStore frame_store[MAX_GEN_REFERENCE_FRAMES]
)
{
    unsigned int i, n, frame_idx;

    for (i = 0, n = 0; i < ref_list_count; i++) {
        const VAPictureH264 * const va_pic = &ref_list[i];

        if (va_pic->flags & VA_PICTURE_H264_INVALID)
            continue;

        for (frame_idx = 0; frame_idx < MAX_GEN_REFERENCE_FRAMES; frame_idx++) {
            const GenFrameStore * const fs = &frame_store[frame_idx];
            if (fs->surface_id != VA_INVALID_ID &&
                fs->surface_id == va_pic->picture_id) {
                assert(frame_idx == fs->frame_store_id);
                break;
            }
        }
        assert(frame_idx < MAX_GEN_REFERENCE_FRAMES);
        state[n++] = get_ref_idx_state_1(va_pic, frame_idx);
    }

    for (; n < 32; n++)
        state[n] = 0xff;
}
예제 #2
0
/* Fill in Reference List Entries (Gen5+: ILK, SNB, IVB) */
void
gen5_fill_avc_ref_idx_state(
    uint8_t             state[32],
    const VAPictureH264 ref_list[32],
    unsigned int        ref_list_count,
    const GenFrameStore frame_store[MAX_GEN_REFERENCE_FRAMES]
)
{
    int i, j;

    for (i = 0; i < ref_list_count; i++) {
        const VAPictureH264 * const va_pic = &ref_list[i];

        if ((va_pic->flags & VA_PICTURE_H264_INVALID) ||
            va_pic->picture_id == VA_INVALID_ID) {
            state[i] = 0xff;
            continue;
        }

        for (j = 0; j < MAX_GEN_REFERENCE_FRAMES; j++) {
            if (frame_store[j].surface_id == va_pic->picture_id)
                break;
        }

        if (j != MAX_GEN_REFERENCE_FRAMES) { // Found picture in the Frame Store
            const GenFrameStore * const fs = &frame_store[j];
            assert(fs->frame_store_id == j); // Current architecture/assumption
            state[i] = get_ref_idx_state_1(va_pic, fs->frame_store_id);
        }
        else {
            WARN_ONCE("Invalid RefPicListX[] entry!!! It is not included in DPB\n");
            state[i] = get_ref_idx_state_1(va_pic, 0) | 0x80;
        }
    }

    for (; i < 32; i++)
        state[i] = 0xff;
}