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@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13768>
This commit is contained in:
Dave Airlie 2021-11-12 14:30:37 +10:00 committed by Marge Bot
parent 29c2f32a57
commit 4b27ebee7f
14 changed files with 23 additions and 28 deletions

View File

@ -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',

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -25,7 +25,7 @@
*
**************************************************************************/
#include "vl/vl_vlc.h"
#include "util/vl_vlc.h"
#include "va_private.h"
#define AV1_REFS_PER_FRAME 7

View File

@ -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,

View File

@ -25,7 +25,7 @@
*
**************************************************************************/
#include "vl/vl_vlc.h"
#include "util/vl_vlc.h"
#include "va_private.h"
#define NUM_VP9_REFS 8

View File

@ -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"

View File

@ -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',

View File

@ -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 */

View File

@ -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;
}
}
}