mirror of
https://github.com/webmproject/libwebp.git
synced 2025-08-29 07:12:05 +02:00
Merge "Add fbounds-safety annotations for palette
." into main
This commit is contained in:
@@ -97,7 +97,9 @@ void PrepareMapToPalette(const uint32_t palette[], uint32_t num_colors,
|
|||||||
#define COLOR_HASH_SIZE (MAX_PALETTE_SIZE * 4)
|
#define COLOR_HASH_SIZE (MAX_PALETTE_SIZE * 4)
|
||||||
#define COLOR_HASH_RIGHT_SHIFT 22 // 32 - log2(COLOR_HASH_SIZE).
|
#define COLOR_HASH_RIGHT_SHIFT 22 // 32 - log2(COLOR_HASH_SIZE).
|
||||||
|
|
||||||
int GetColorPalette(const WebPPicture* const pic, uint32_t* const palette) {
|
int GetColorPalette(const WebPPicture* const pic,
|
||||||
|
uint32_t* const WEBP_COUNTED_BY_OR_NULL(MAX_PALETTE_SIZE)
|
||||||
|
palette) {
|
||||||
int i;
|
int i;
|
||||||
int x, y;
|
int x, y;
|
||||||
int num_colors = 0;
|
int num_colors = 0;
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#define WEBP_UTILS_PALETTE_H_
|
#define WEBP_UTILS_PALETTE_H_
|
||||||
|
|
||||||
#include "src/utils/bounds_safety.h"
|
#include "src/utils/bounds_safety.h"
|
||||||
|
#include "src/webp/format_constants.h"
|
||||||
#include "src/webp/types.h"
|
#include "src/webp/types.h"
|
||||||
|
|
||||||
WEBP_ASSUME_UNSAFE_INDEXABLE_ABI
|
WEBP_ASSUME_UNSAFE_INDEXABLE_ABI
|
||||||
@@ -51,7 +52,8 @@ void PrepareMapToPalette(const uint32_t palette[], uint32_t num_colors,
|
|||||||
// 'palette' in a sorted order. Note: 'palette' is assumed to be an array
|
// 'palette' in a sorted order. Note: 'palette' is assumed to be an array
|
||||||
// already allocated with at least MAX_PALETTE_SIZE elements.
|
// already allocated with at least MAX_PALETTE_SIZE elements.
|
||||||
int GetColorPalette(const struct WebPPicture* const pic,
|
int GetColorPalette(const struct WebPPicture* const pic,
|
||||||
uint32_t* const palette);
|
uint32_t* const WEBP_COUNTED_BY_OR_NULL(MAX_PALETTE_SIZE)
|
||||||
|
palette);
|
||||||
|
|
||||||
// Sorts the palette according to the criterion defined by 'method'.
|
// Sorts the palette according to the criterion defined by 'method'.
|
||||||
// 'palette_sorted' is the input palette sorted lexicographically, as done in
|
// 'palette_sorted' is the input palette sorted lexicographically, as done in
|
||||||
|
@@ -271,7 +271,9 @@ void WebPCopyPixels(const WebPPicture* const src, WebPPicture* const dst) {
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
int WebPGetColorPalette(const WebPPicture* const pic, uint32_t* const palette) {
|
int WebPGetColorPalette(
|
||||||
|
const WebPPicture* const pic,
|
||||||
|
uint32_t* const WEBP_COUNTED_BY_OR_NULL(MAX_PALETTE_SIZE) palette) {
|
||||||
return GetColorPalette(pic, palette);
|
return GetColorPalette(pic, palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "src/utils/bounds_safety.h"
|
#include "src/utils/bounds_safety.h"
|
||||||
|
#include "src/webp/format_constants.h"
|
||||||
#include "src/webp/types.h"
|
#include "src/webp/types.h"
|
||||||
|
|
||||||
WEBP_ASSUME_UNSAFE_INDEXABLE_ABI
|
WEBP_ASSUME_UNSAFE_INDEXABLE_ABI
|
||||||
@@ -204,8 +205,9 @@ WEBP_EXTERN void WebPCopyPixels(const struct WebPPicture* const src,
|
|||||||
// Note: 'palette' is assumed to be an array already allocated with at least
|
// Note: 'palette' is assumed to be an array already allocated with at least
|
||||||
// MAX_PALETTE_SIZE elements.
|
// MAX_PALETTE_SIZE elements.
|
||||||
// TODO(vrabaud) remove whenever we can break the ABI.
|
// TODO(vrabaud) remove whenever we can break the ABI.
|
||||||
WEBP_EXTERN int WebPGetColorPalette(const struct WebPPicture* const pic,
|
WEBP_EXTERN int WebPGetColorPalette(
|
||||||
uint32_t* const palette);
|
const struct WebPPicture* const pic,
|
||||||
|
uint32_t* const WEBP_COUNTED_BY_OR_NULL(MAX_PALETTE_SIZE) palette);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user