summaryrefslogtreecommitdiffstats
path: root/multimedia/ffmpeg/patches/124-v4l2-request-vc1-03.patch
blob: bc5e6c600738ca2c02accbe678aee7fe0563efed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 8feb356396399b62401123ba4981d9a955656c7b Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Thu, 8 Oct 2026 18:39:59 +0200
Subject: [PATCH 3/5] avcodec/vc1: read RESPIC only in I and P pictures

RESPIC is present in Simple and Main profile I and P pictures only
(SMPTE 421M 7.1.1.23, and the SMPTE reference decoder); B and BI
pictures keep the value of the last I or P picture. The B check missed
BI pictures, which are signalled as B pictures with BFRACTION = 0 and
have been turned into AV_PICTURE_TYPE_BI by then, so 2 bits too many
were read from the header of every BI picture of a MULTIRES sequence.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
OpenWrt: patch 3/5 of LibreELEC's
packages/multimedia/ffmpeg/patches/v4l2-request/0002-v4l2-request-vc1.patch
(LibreELEC commit d38b323eea). Not in FFmpeg 9.1.

 libavcodec/vc1.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -746,7 +746,8 @@ int ff_vc1_parse_frame_header(VC1Context
     v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
     v->range_x = 1 << (v->k_x - 1);
     v->range_y = 1 << (v->k_y - 1);
-    if (v->multires && v->s.pict_type != AV_PICTURE_TYPE_B)
+    if (v->multires && (v->s.pict_type == AV_PICTURE_TYPE_I ||
+                        v->s.pict_type == AV_PICTURE_TYPE_P))
         v->respic = get_bits(gb, 2);
 
     if (v->res_x8 && (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI)) {