vpx_codec_err_t vp10_copy_reference_dec(VP10Decoder *pbi, VP9_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) { VP10_COMMON *cm = &pbi->common; /* TODO(jkoleszar): The decoder doesn't have any real knowledge of what the * encoder is using the frame buffers for. This is just a stub to keep the * vpxenc --test-decode functionality working, and will be replaced in a * later commit that adds VP9-specific controls for this functionality. */ if (ref_frame_flag == VP9_LAST_FLAG) { const YV12_BUFFER_CONFIG *const cfg = get_ref_frame(cm, 0); if (cfg == NULL) { vpx_internal_error(&cm->error, VPX_CODEC_ERROR, "No 'last' reference frame"); return VPX_CODEC_ERROR; } if (!equal_dimensions(cfg, sd)) vpx_internal_error(&cm->error, VPX_CODEC_ERROR, "Incorrect buffer dimensions"); else vp8_yv12_copy_frame(cfg, sd); } else { vpx_internal_error(&cm->error, VPX_CODEC_ERROR, "Invalid reference frame"); } return cm->error.error_code; }
aom_codec_err_t av1_copy_reference_dec(AV1Decoder *pbi, int idx, YV12_BUFFER_CONFIG *sd) { AV1_COMMON *cm = &pbi->common; const YV12_BUFFER_CONFIG *const cfg = get_ref_frame(cm, idx); if (cfg == NULL) { aom_internal_error(&cm->error, AOM_CODEC_ERROR, "No reference frame"); return AOM_CODEC_ERROR; } if (!equal_dimensions(cfg, sd)) aom_internal_error(&cm->error, AOM_CODEC_ERROR, "Incorrect buffer dimensions"); else aom_yv12_copy_frame(cfg, sd); return cm->error.error_code; }
aom_codec_err_t av1_set_reference_dec(AV1_COMMON *cm, int idx, YV12_BUFFER_CONFIG *sd) { YV12_BUFFER_CONFIG *ref_buf = NULL; // Get the destination reference buffer. ref_buf = get_ref_frame(cm, idx); if (ref_buf == NULL) { aom_internal_error(&cm->error, AOM_CODEC_ERROR, "No reference frame"); return AOM_CODEC_ERROR; } if (!equal_dimensions(ref_buf, sd)) { aom_internal_error(&cm->error, AOM_CODEC_ERROR, "Incorrect buffer dimensions"); } else { // Overwrite the reference frame buffer. aom_yv12_copy_frame(sd, ref_buf); } return cm->error.error_code; }