History

vulkan_vp9: Read segment and lf data from cbs

The previous change 26a2a76346 broke Vulkan decoding because the lf and segmentation values contained within VP9RawFrameHeader can no longer be updated. Read the propogated values from the CBS instead. (cherry picked from commit 7bfaa6d662f1f5eb000b0fae8288b07440464bff)

Benjamin Cheng committed 1 year ago

Commit 15cb74f1 parent 9ddd2451 file · +15 −14Browse files

Unified · Split

libavcodec/vulkan_vp9.c+15−14
@@ -16,7 +16,7 @@ · 15 unmodified lines
1616 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1717 */
1818
19−#include "vp9shared.h"
19+#include "vp9dec.h"
2020
2121 #include "vulkan_decode.h"
2222
@@ -109,7 +109,9 @@ static int vk_vp9_start_frame(AVCodecContext *avctx, · 86 unmodified lines
109109 {
110110 int err;
111111 int ref_count = 0;
112− const VP9SharedContext *s = avctx->priv_data;
112+ const VP9Context *priv = avctx->priv_data;
113+ const CodedBitstreamVP9Context *vp9 = priv->cbc->priv_data;
114+ const VP9SharedContext *s = &priv->s;
113115 uint32_t frame_id_alloc_mask = 0;
114116
115117 const VP9Frame *pic = &s->frames[CUR_FRAME];
@@ -182,15 +184,14 @@ static int vk_vp9_start_frame(AVCodecContext *avctx, · 66 unmodified lines
182184 .update_mode_delta = 0x0,
183185 };
184186
185− for (int i = 0; i < 2; i++)
186− ap->loop_filter.update_mode_delta |= pic->frame_header->update_mode_delta[i];
187−
188187 for (int i = 0; i < STD_VIDEO_VP9_MAX_REF_FRAMES; i++) {
189− ap->loop_filter.loop_filter_ref_deltas[i] = pic->frame_header->loop_filter_ref_deltas[i];
188+ ap->loop_filter.loop_filter_ref_deltas[i] = vp9->loop_filter_ref_deltas[i];
190189 ap->loop_filter.update_ref_delta |= pic->frame_header->update_ref_delta[i];
191190 }
192− for (int i = 0; i < STD_VIDEO_VP9_LOOP_FILTER_ADJUSTMENTS; i++)
193− ap->loop_filter.loop_filter_mode_deltas[i] = pic->frame_header->loop_filter_mode_deltas[i];
191+ for (int i = 0; i < STD_VIDEO_VP9_LOOP_FILTER_ADJUSTMENTS; i++) {
192+ ap->loop_filter.loop_filter_mode_deltas[i] = vp9->loop_filter_mode_deltas[i];
193+ ap->loop_filter.update_mode_delta |= pic->frame_header->update_mode_delta[i];
194+ }
194195
195196 ap->segmentation = (StdVideoVP9Segmentation) {
196197 .flags = (StdVideoVP9SegmentationFlags) {
@@ -202,16 +203,16 @@ static int vk_vp9_start_frame(AVCodecContext *avctx, · 5 unmodified lines
202203 };
203204
204205 for (int i = 0; i < STD_VIDEO_VP9_MAX_SEGMENTATION_TREE_PROBS; i++)
205− ap->segmentation.segmentation_tree_probs[i] = pic->frame_header->segmentation_tree_probs[i];
206+ ap->segmentation.segmentation_tree_probs[i] = vp9->segmentation_tree_probs[i];
206207 for (int i = 0; i < STD_VIDEO_VP9_MAX_SEGMENTATION_PRED_PROB; i++)
207− ap->segmentation.segmentation_pred_prob[i] = pic->frame_header->segmentation_pred_prob[i];
208+ ap->segmentation.segmentation_pred_prob[i] = vp9->segmentation_pred_prob[i];
208209 for (int i = 0; i < STD_VIDEO_VP9_MAX_SEGMENTS; i++) {
209210 ap->segmentation.FeatureEnabled[i] = 0x0;
210211 for (int j = 0; j < STD_VIDEO_VP9_SEG_LVL_MAX; j++) {
211− ap->segmentation.FeatureEnabled[i] |= pic->frame_header->feature_enabled[i][j] << j;
212− ap->segmentation.FeatureData[i][j] = pic->frame_header->feature_sign[i][j] ?
213− -pic->frame_header->feature_value[i][j] :
214− +pic->frame_header->feature_value[i][j];
212+ ap->segmentation.FeatureEnabled[i] |= vp9->feature_enabled[i][j] << j;
213+ ap->segmentation.FeatureData[i][j] = vp9->feature_sign[i][j] ?
214+ -vp9->feature_value[i][j] :
215+ +vp9->feature_value[i][j];
215216 }
216217 }
217218

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t