Mesa (main): util/vl: move gallium vl_vlc.h and vl_rbsp.h to shared code.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Nov 15 22:24:08 UTC 2021
Module: Mesa
Branch: main
Commit: 4b27ebee7f0982c35547f563540621d54064ec04
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b27ebee7f0982c35547f563540621d54064ec04
Author: Dave Airlie <airlied at redhat.com>
Date: Fri Nov 12 14:30:37 2021 +1000
util/vl: move gallium vl_vlc.h and vl_rbsp.h to shared code.
For vulkan video I need these to parse slice headers, so move
them somewhere easier to get at them.
drops pointer_to_uintptr in favour of a cast.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13768>
---
src/gallium/auxiliary/meson.build | 2 --
src/gallium/frontends/omx/bellagio/vid_dec.c | 2 +-
src/gallium/frontends/omx/bellagio/vid_dec_h264.c | 2 +-
src/gallium/frontends/omx/bellagio/vid_dec_h265.c | 2 +-
src/gallium/frontends/omx/bellagio/vid_dec_mpeg12.c | 2 +-
src/gallium/frontends/omx/vid_dec_common.h | 2 +-
src/gallium/frontends/va/picture.c | 2 +-
src/gallium/frontends/va/picture_av1.c | 2 +-
src/gallium/frontends/va/picture_hevc_enc.c | 3 +--
src/gallium/frontends/va/picture_vp9.c | 2 +-
src/gallium/frontends/vdpau/decode.c | 2 +-
src/util/meson.build | 2 ++
src/{gallium/auxiliary/vl => util}/vl_rbsp.h | 8 ++++----
src/{gallium/auxiliary/vl => util}/vl_vlc.h | 18 +++++++-----------
14 files changed, 23 insertions(+), 28 deletions(-)
diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build
index 7682357edf0..868bb327242 100644
--- a/src/gallium/auxiliary/meson.build
+++ b/src/gallium/auxiliary/meson.build
@@ -452,13 +452,11 @@ files_libgalliumvl = files(
'vl/vl_mpeg12_bitstream.h',
'vl/vl_mpeg12_decoder.c',
'vl/vl_mpeg12_decoder.h',
- 'vl/vl_rbsp.h',
'vl/vl_types.h',
'vl/vl_vertex_buffers.c',
'vl/vl_vertex_buffers.h',
'vl/vl_video_buffer.c',
'vl/vl_video_buffer.h',
- 'vl/vl_vlc.h',
'vl/vl_zscan.c',
'vl/vl_zscan.h',
'vl/vl_probs_table.h',
diff --git a/src/gallium/frontends/omx/bellagio/vid_dec.c b/src/gallium/frontends/omx/bellagio/vid_dec.c
index 8c7ca571771..8cca05f675d 100644
--- a/src/gallium/frontends/omx/bellagio/vid_dec.c
+++ b/src/gallium/frontends/omx/bellagio/vid_dec.c
@@ -49,7 +49,7 @@
#include "util/u_memory.h"
#include "util/u_surface.h"
#include "vl/vl_video_buffer.h"
-#include "vl/vl_vlc.h"
+#include "util/vl_vlc.h"
#include "entrypoint.h"
#include "vid_dec.h"
diff --git a/src/gallium/frontends/omx/bellagio/vid_dec_h264.c b/src/gallium/frontends/omx/bellagio/vid_dec_h264.c
index 1a198a97e96..24a9925e070 100644
--- a/src/gallium/frontends/omx/bellagio/vid_dec_h264.c
+++ b/src/gallium/frontends/omx/bellagio/vid_dec_h264.c
@@ -34,7 +34,7 @@
#include "pipe/p_video_codec.h"
#include "util/u_memory.h"
#include "util/u_video.h"
-#include "vl/vl_rbsp.h"
+#include "util/vl_rbsp.h"
#include "vl/vl_zscan.h"
#include "entrypoint.h"
diff --git a/src/gallium/frontends/omx/bellagio/vid_dec_h265.c b/src/gallium/frontends/omx/bellagio/vid_dec_h265.c
index 5fa199990f9..12bb97d3d90 100644
--- a/src/gallium/frontends/omx/bellagio/vid_dec_h265.c
+++ b/src/gallium/frontends/omx/bellagio/vid_dec_h265.c
@@ -28,7 +28,7 @@
#include "pipe/p_video_codec.h"
#include "util/u_memory.h"
#include "util/u_video.h"
-#include "vl/vl_rbsp.h"
+#include "util/vl_rbsp.h"
#include "entrypoint.h"
#include "vid_dec.h"
diff --git a/src/gallium/frontends/omx/bellagio/vid_dec_mpeg12.c b/src/gallium/frontends/omx/bellagio/vid_dec_mpeg12.c
index f64c2b83fa5..f77d2812d3e 100644
--- a/src/gallium/frontends/omx/bellagio/vid_dec_mpeg12.c
+++ b/src/gallium/frontends/omx/bellagio/vid_dec_mpeg12.c
@@ -32,7 +32,7 @@
*/
#include "pipe/p_video_codec.h"
-#include "vl/vl_vlc.h"
+#include "util/vl_vlc.h"
#include "vl/vl_zscan.h"
#include "vid_dec.h"
diff --git a/src/gallium/frontends/omx/vid_dec_common.h b/src/gallium/frontends/omx/vid_dec_common.h
index 72d124783cc..8077a2c9e97 100644
--- a/src/gallium/frontends/omx/vid_dec_common.h
+++ b/src/gallium/frontends/omx/vid_dec_common.h
@@ -29,9 +29,9 @@
#define VID_DEC_COMMON_H
#include "util/list.h"
+#include "util/vl_rbsp.h"
#include "vl/vl_compositor.h"
-#include "vl/vl_rbsp.h"
#include "vl/vl_zscan.h"
#include "bellagio/vid_dec_av1.h"
diff --git a/src/gallium/frontends/va/picture.c b/src/gallium/frontends/va/picture.c
index 9e630eefc97..84cc16ccb01 100644
--- a/src/gallium/frontends/va/picture.c
+++ b/src/gallium/frontends/va/picture.c
@@ -32,7 +32,7 @@
#include "util/u_video.h"
#include "util/u_memory.h"
-#include "vl/vl_vlc.h"
+#include "util/vl_vlc.h"
#include "vl/vl_winsys.h"
#include "va_private.h"
diff --git a/src/gallium/frontends/va/picture_av1.c b/src/gallium/frontends/va/picture_av1.c
index d48163647dc..3d1ee6287e6 100644
--- a/src/gallium/frontends/va/picture_av1.c
+++ b/src/gallium/frontends/va/picture_av1.c
@@ -25,7 +25,7 @@
*
**************************************************************************/
-#include "vl/vl_vlc.h"
+#include "util/vl_vlc.h"
#include "va_private.h"
#define AV1_REFS_PER_FRAME 7
diff --git a/src/gallium/frontends/va/picture_hevc_enc.c b/src/gallium/frontends/va/picture_hevc_enc.c
index 17bc252ae5e..e266f1835dd 100644
--- a/src/gallium/frontends/va/picture_hevc_enc.c
+++ b/src/gallium/frontends/va/picture_hevc_enc.c
@@ -29,8 +29,7 @@
#include "util/u_video.h"
#include "va_private.h"
-#include "vl/vl_vlc.h"
-#include "vl/vl_rbsp.h"
+#include "util/vl_rbsp.h"
enum HEVCNALUnitType {
HEVC_NAL_VPS = 32,
diff --git a/src/gallium/frontends/va/picture_vp9.c b/src/gallium/frontends/va/picture_vp9.c
index f7b52ddf691..ce5b046b990 100644
--- a/src/gallium/frontends/va/picture_vp9.c
+++ b/src/gallium/frontends/va/picture_vp9.c
@@ -25,7 +25,7 @@
*
**************************************************************************/
-#include "vl/vl_vlc.h"
+#include "util/vl_vlc.h"
#include "va_private.h"
#define NUM_VP9_REFS 8
diff --git a/src/gallium/frontends/vdpau/decode.c b/src/gallium/frontends/vdpau/decode.c
index d5d62c4986b..ede080b04e4 100644
--- a/src/gallium/frontends/vdpau/decode.c
+++ b/src/gallium/frontends/vdpau/decode.c
@@ -30,7 +30,7 @@
#include "util/u_debug.h"
#include "util/u_video.h"
-#include "vl/vl_vlc.h"
+#include "util/vl_vlc.h"
#include "vdpau_private.h"
diff --git a/src/util/meson.build b/src/util/meson.build
index dcadf34933c..92ed937622f 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -145,6 +145,8 @@ files_mesa_util = files(
'u_cpu_detect.h',
'u_printf.cpp',
'u_printf.h',
+ 'vl_vlc.h',
+ 'vl_rbsp.h',
'vma.c',
'vma.h',
'xxhash.h',
diff --git a/src/gallium/auxiliary/vl/vl_rbsp.h b/src/util/vl_rbsp.h
similarity index 98%
rename from src/gallium/auxiliary/vl/vl_rbsp.h
rename to src/util/vl_rbsp.h
index 4d90c2de09c..3ef4f6f778d 100644
--- a/src/gallium/auxiliary/vl/vl_rbsp.h
+++ b/src/util/vl_rbsp.h
@@ -38,7 +38,7 @@
#ifndef vl_rbsp_h
#define vl_rbsp_h
-#include "vl/vl_vlc.h"
+#include "util/vl_vlc.h"
struct vl_rbsp {
struct vl_vlc nal;
@@ -163,14 +163,14 @@ static inline bool vl_rbsp_more_data(struct vl_rbsp *rbsp)
unsigned bits, value;
if (vl_vlc_bits_left(&rbsp->nal) > 8)
- return TRUE;
+ return true;
bits = vl_vlc_valid_bits(&rbsp->nal);
value = vl_vlc_peekbits(&rbsp->nal, bits);
if (value == 0 || value == (1 << (bits - 1)))
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
#endif /* vl_rbsp_h */
diff --git a/src/gallium/auxiliary/vl/vl_vlc.h b/src/util/vl_vlc.h
similarity index 96%
rename from src/gallium/auxiliary/vl/vl_vlc.h
rename to src/util/vl_vlc.h
index 4c3a5400945..89f03b4a78e 100644
--- a/src/gallium/auxiliary/vl/vl_vlc.h
+++ b/src/util/vl_vlc.h
@@ -32,11 +32,7 @@
#ifndef vl_vlc_h
#define vl_vlc_h
-#include "pipe/p_compiler.h"
-
#include "util/u_math.h"
-#include "util/u_pointer.h"
-#include "util/u_debug.h"
struct vl_vlc
{
@@ -116,7 +112,7 @@ static inline void
vl_vlc_align_data_ptr(struct vl_vlc *vlc)
{
/* align the data pointer */
- while (vlc->data != vlc->end && pointer_to_uintptr(vlc->data) & 3) {
+ while (vlc->data != vlc->end && ((uintptr_t)vlc->data) & 3) {
vlc->buffer |= (uint64_t)*vlc->data << (24 + vlc->invalid_bits);
++vlc->data;
vlc->invalid_bits -= 8;
@@ -288,7 +284,7 @@ vl_vlc_get_vlclbf(struct vl_vlc *vlc, const struct vl_vlc_entry *tbl, unsigned n
/**
* fast forward search for a specific byte value
*/
-static inline boolean
+static inline bool
vl_vlc_search_byte(struct vl_vlc *vlc, unsigned num_bits, uint8_t value)
{
/* make sure we are on a byte boundary */
@@ -300,7 +296,7 @@ vl_vlc_search_byte(struct vl_vlc *vlc, unsigned num_bits, uint8_t value)
if (vl_vlc_peekbits(vlc, 8) == value) {
vl_vlc_fillbits(vlc);
- return TRUE;
+ return true;
}
vl_vlc_eatbits(vlc, 8);
@@ -308,7 +304,7 @@ vl_vlc_search_byte(struct vl_vlc *vlc, unsigned num_bits, uint8_t value)
if (num_bits != ~0u) {
num_bits -= 8;
if (num_bits == 0)
- return FALSE;
+ return false;
}
}
@@ -322,13 +318,13 @@ vl_vlc_search_byte(struct vl_vlc *vlc, unsigned num_bits, uint8_t value)
vl_vlc_next_input(vlc);
else
/* or give up since we don't have anymore inputs */
- return FALSE;
+ return false;
}
if (*vlc->data == value) {
vl_vlc_align_data_ptr(vlc);
vl_vlc_fillbits(vlc);
- return TRUE;
+ return true;
}
++vlc->data;
@@ -336,7 +332,7 @@ vl_vlc_search_byte(struct vl_vlc *vlc, unsigned num_bits, uint8_t value)
num_bits -= 8;
if (num_bits == 0) {
vl_vlc_align_data_ptr(vlc);
- return FALSE;
+ return false;
}
}
}
More information about the mesa-commit
mailing list