Module: Mesa
Branch: main
Commit: a28994f73c791a909c92440d9cbc7d5dac57481d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a28994f73c791a909c92440d9cbc7d5dac57481d

Author: Hyunjun Ko <[email protected]>
Date:   Fri Jun 16 15:09:11 2023 +0900

util/rbsp: keep track of removed bits for the emulation
 prevention three bytes.

This is needed for the next patch to fix a way to get how much data
is comsumed in rbsp by considering cases of removed bits for emulation
prevention three bytes.

Signed-off-by: Hyunjun Ko <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23688>

---

 src/util/vl_rbsp.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/vl_rbsp.h b/src/util/vl_rbsp.h
index 3ef4f6f778d..c2d9b2b5c33 100644
--- a/src/util/vl_rbsp.h
+++ b/src/util/vl_rbsp.h
@@ -43,6 +43,7 @@
 struct vl_rbsp {
    struct vl_vlc nal;
    unsigned escaped;
+   unsigned removed;
 };
 
 /**
@@ -78,6 +79,7 @@ static inline void vl_rbsp_init(struct vl_rbsp *rbsp, struct 
vl_vlc *nal, unsign
    valid = vl_vlc_valid_bits(&rbsp->nal);
 
    rbsp->escaped = (valid >= 16) ? 16 : ((valid >= 8) ? 8 : 0);
+   rbsp->removed = 0;
 }
 
 /**
@@ -112,6 +114,7 @@ static inline void vl_rbsp_fillbits(struct vl_rbsp *rbsp)
          vl_vlc_removebits(&rbsp->nal, i - 8, 8);
          rbsp->escaped = bits - i;
          bits -= 8;
+         rbsp->removed += 8;
          i += 8;
       }
    }

Reply via email to