33 int with_pal_size, contains_pal,
size,
stride, padding, y;
36 if (par->
height <= 0 || min_stride <= 0 || expected_stride <= 0 ||
37 min_stride > (INT_MAX - 1024) / par->
height ||
41 with_pal_size = min_stride * par->
height + 1024;
42 contains_pal = bpc == 8 &&
pkt->size == with_pal_size;
45 padding = expected_stride -
FFMIN(expected_stride,
stride);
47 if (
pkt->size == expected_stride * par->
height)
64 for (y = 0; y<par->
height; y++) {
66 memset(new_pkt->
data + y*expected_stride + expected_stride - padding, 0, padding);
70 return 1 + contains_pal;
#define i(width, name, range_min, range_max)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette)
Retrieves the palette from a packet, either from side data, or appended to the video data in the pack...
int ff_reshuffle_raw_rgb(AVFormatContext *s, AVPacket **ppkt, AVCodecParameters *par, int expected_stride)
Reshuffles the lines to use the user specified stride.
This struct describes the properties of an encoded stream.
int height
The height of the video frame in pixels.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
int width
The width of the video frame in pixels.
This structure stores compressed data.