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
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */17 */
18 18
19#include "vp9shared.h"19#include "vp9dec.h"
20 20
21#include "vulkan_decode.h"21#include "vulkan_decode.h"
22 22
@@ -109,7 +109,9 @@ static int vk_vp9_start_frame(AVCodecContext *avctx, · 86 unmodified lines
109{109{
110 int err;110 int err;
111 int ref_count = 0;111 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;
113 uint32_t frame_id_alloc_mask = 0;115 uint32_t frame_id_alloc_mask = 0;
114 116
115 const VP9Frame *pic = &s->frames[CUR_FRAME];117 const VP9Frame *pic = &s->frames[CUR_FRAME];
@@ -182,15 +184,14 @@ static int vk_vp9_start_frame(AVCodecContext *avctx, · 66 unmodified lines
182 .update_mode_delta = 0x0,184 .update_mode_delta = 0x0,
183 };185 };
184 186
185 for (int i = 0; i < 2; i++)
186 ap->loop_filter.update_mode_delta |= pic->frame_header->update_mode_delta[i];
187
188 for (int i = 0; i < STD_VIDEO_VP9_MAX_REF_FRAMES; i++) {187 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];
190 ap->loop_filter.update_ref_delta |= pic->frame_header->update_ref_delta[i];189 ap->loop_filter.update_ref_delta |= pic->frame_header->update_ref_delta[i];
191 }190 }
192 for (int i = 0; i < STD_VIDEO_VP9_LOOP_FILTER_ADJUSTMENTS; i++)191 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];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 }
194 195
195 ap->segmentation = (StdVideoVP9Segmentation) {196 ap->segmentation = (StdVideoVP9Segmentation) {
196 .flags = (StdVideoVP9SegmentationFlags) {197 .flags = (StdVideoVP9SegmentationFlags) {
@@ -202,16 +203,16 @@ static int vk_vp9_start_frame(AVCodecContext *avctx, · 5 unmodified lines
202 };203 };
203 204
204 for (int i = 0; i < STD_VIDEO_VP9_MAX_SEGMENTATION_TREE_PROBS; i++)205 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];
206 for (int i = 0; i < STD_VIDEO_VP9_MAX_SEGMENTATION_PRED_PROB; i++)207 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];
208 for (int i = 0; i < STD_VIDEO_VP9_MAX_SEGMENTS; i++) {209 for (int i = 0; i < STD_VIDEO_VP9_MAX_SEGMENTS; i++) {
209 ap->segmentation.FeatureEnabled[i] = 0x0;210 ap->segmentation.FeatureEnabled[i] = 0x0;
210 for (int j = 0; j < STD_VIDEO_VP9_SEG_LVL_MAX; j++) {211 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.FeatureEnabled[i] |= vp9->feature_enabled[i][j] << j;
212 ap->segmentation.FeatureData[i][j] = pic->frame_header->feature_sign[i][j] ?213 ap->segmentation.FeatureData[i][j] = vp9->feature_sign[i][j] ?
213 -pic->frame_header->feature_value[i][j] :214 -vp9->feature_value[i][j] :
214 +pic->frame_header->feature_value[i][j];215 +vp9->feature_value[i][j];
215 }216 }
216 }217 }
217 218

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