bool VaapiDecoderH265::fillIqMatrix(const PicturePtr& picture, const H265SliceHdr* const slice) { H265PPS* pps = slice->pps; H265SPS* sps = pps->sps; H265ScalingList* scalingList; if (pps->scaling_list_data_present_flag) { scalingList = &pps->scaling_list; } else if(sps->scaling_list_enabled_flag) { if(sps->scaling_list_data_present_flag) { scalingList = &sps->scaling_list; } else { scalingList = &pps->scaling_list; } } else { //default scaling list return true; } VAIQMatrixBufferHEVC* iqMatrix; if (!picture->editIqMatrix(iqMatrix)) return false; fillScalingList4x4(iqMatrix, scalingList); fillScalingList8x8(iqMatrix, scalingList); fillScalingList16x16(iqMatrix, scalingList); fillScalingList32x32(iqMatrix, scalingList); fillScalingListDc16x16(iqMatrix, scalingList); fillScalingListDc32x32(iqMatrix, scalingList); return true; }
/* fill quant parameter buffers functions*/ bool VaapiDecoderVP8::ensureQuantMatrix(const PicturePtr& pic) { Vp8Segmentation *seg = &m_parser.segmentation; VAIQMatrixBufferVP8 *iqMatrix; int32_t baseQI, i; if (!pic->editIqMatrix(iqMatrix)) return false; for (i = 0; i < 4; i++) { int32_t tempIndex; const int32_t MAX_QI_INDEX = 127; if (seg->segmentation_enabled) { baseQI = seg->quantizer_update_value[i]; if (!seg->segment_feature_mode) // 0 means delta update baseQI += m_frameHdr.quant_indices.y_ac_qi;; } else baseQI = m_frameHdr.quant_indices.y_ac_qi; // the first component is y_ac_qi tempIndex = baseQI < 0 ? 0 : (baseQI > MAX_QI_INDEX ? MAX_QI_INDEX : baseQI); iqMatrix->quantization_index[i][0] = tempIndex; tempIndex = baseQI + m_frameHdr.quant_indices.y_dc_delta; tempIndex = tempIndex < 0 ? 0 : (tempIndex > MAX_QI_INDEX ? MAX_QI_INDEX : tempIndex); iqMatrix->quantization_index[i][1] = tempIndex; tempIndex = baseQI + m_frameHdr.quant_indices.y2_dc_delta; tempIndex = tempIndex < 0 ? 0 : (tempIndex > MAX_QI_INDEX ? MAX_QI_INDEX : tempIndex); iqMatrix->quantization_index[i][2] = tempIndex; tempIndex = baseQI + m_frameHdr.quant_indices.y2_ac_delta; tempIndex = tempIndex < 0 ? 0 : (tempIndex > MAX_QI_INDEX ? MAX_QI_INDEX : tempIndex); iqMatrix->quantization_index[i][3] = tempIndex; tempIndex = baseQI + m_frameHdr.quant_indices.uv_dc_delta; tempIndex = tempIndex < 0 ? 0 : (tempIndex > MAX_QI_INDEX ? MAX_QI_INDEX : tempIndex); iqMatrix->quantization_index[i][4] = tempIndex; tempIndex = baseQI + m_frameHdr.quant_indices.uv_ac_delta; tempIndex = tempIndex < 0 ? 0 : (tempIndex > MAX_QI_INDEX ? MAX_QI_INDEX : tempIndex); iqMatrix->quantization_index[i][5] = tempIndex; } return true; }