Mesa (master): vl/rbsp: match initial escaped bits with valid in the buffer

Leo Liu leoliu at kemper.freedesktop.org
Mon Sep 12 14:39:12 UTC 2016


Module: Mesa
Branch: master
Commit: 6a7f79af9b1ac4380e46c1bc438a7a491d1d99da
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a7f79af9b1ac4380e46c1bc438a7a491d1d99da

Author: Leo Liu <leo.liu at amd.com>
Date:   Tue Sep  6 13:14:48 2016 -0400

vl/rbsp: match initial escaped bits with valid in the buffer

Otherwise the check for the three byte will not make sense.

Signed-off-by: Leo Liu <leo.liu at amd.com>

---

 src/gallium/auxiliary/vl/vl_rbsp.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_rbsp.h b/src/gallium/auxiliary/vl/vl_rbsp.h
index 160b2f8..4d90c2d 100644
--- a/src/gallium/auxiliary/vl/vl_rbsp.h
+++ b/src/gallium/auxiliary/vl/vl_rbsp.h
@@ -56,8 +56,6 @@ static inline void vl_rbsp_init(struct vl_rbsp *rbsp, struct vl_vlc *nal, unsign
    /* copy the position */
    rbsp->nal = *nal;
 
-   rbsp->escaped = 16;
-
    /* search for the end of the NAL unit */
    while (vl_vlc_search_byte(nal, num_bits, 0x00)) {
       if (vl_vlc_peekbits(nal, 24) == 0x000001 ||
@@ -76,6 +74,10 @@ static inline void vl_rbsp_init(struct vl_rbsp *rbsp, struct vl_vlc *nal, unsign
          i += 8;
       }
    }
+
+   valid = vl_vlc_valid_bits(&rbsp->nal);
+
+   rbsp->escaped = (valid >= 16) ? 16 : ((valid >= 8) ? 8 : 0);
 }
 
 /**




More information about the mesa-commit mailing list