mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-27 17:53:13 +00:00
Merge commit 'c19830aa2c19f9713b612f7e2fdb437df91ba266'
* commit 'c19830aa2c19f9713b612f7e2fdb437df91ba266':
rscc: Support palette format
See 11777eb814
Merged-by: Clément Bœsch <u@pkh.me>
This commit is contained in:
commit
5f044d2372
@ -31,7 +31,7 @@
|
|||||||
* and it can be deflated or not. Similarly, pixel data comes after the header
|
* and it can be deflated or not. Similarly, pixel data comes after the header
|
||||||
* and a variable size value, and it can be deflated or just raw.
|
* and a variable size value, and it can be deflated or just raw.
|
||||||
*
|
*
|
||||||
* Supports: BGRA, BGR24, RGB555, PAL8
|
* Supports: PAL8, BGRA, BGR24, RGB555
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -58,7 +58,8 @@ typedef struct RsccContext {
|
|||||||
Tile *tiles;
|
Tile *tiles;
|
||||||
unsigned int tiles_size;
|
unsigned int tiles_size;
|
||||||
int component_size;
|
int component_size;
|
||||||
uint32_t pal[AVPALETTE_COUNT];
|
|
||||||
|
uint8_t palette[AVPALETTE_SIZE];
|
||||||
|
|
||||||
/* zlib interaction */
|
/* zlib interaction */
|
||||||
uint8_t *inflated_buf;
|
uint8_t *inflated_buf;
|
||||||
@ -309,19 +310,22 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
} else {
|
} else {
|
||||||
frame->pict_type = AV_PICTURE_TYPE_P;
|
frame->pict_type = AV_PICTURE_TYPE_P;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Palette handling */
|
||||||
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
|
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
|
||||||
int size;
|
int size;
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt,
|
const uint8_t *palette = av_packet_get_side_data(avpkt,
|
||||||
AV_PKT_DATA_PALETTE,
|
AV_PKT_DATA_PALETTE,
|
||||||
&size);
|
&size);
|
||||||
if (pal && size == AVPALETTE_SIZE) {
|
if (palette && size == AVPALETTE_SIZE) {
|
||||||
frame->palette_has_changed = 1;
|
frame->palette_has_changed = 1;
|
||||||
memcpy(ctx->pal, pal, AVPALETTE_SIZE);
|
memcpy(ctx->palette, palette, AVPALETTE_SIZE);
|
||||||
} else if (pal) {
|
} else if (palette) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
|
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
|
||||||
}
|
}
|
||||||
memcpy (frame->data[1], ctx->pal, AVPALETTE_SIZE);
|
memcpy (frame->data[1], ctx->palette, AVPALETTE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
|
|
||||||
ret = avpkt->size;
|
ret = avpkt->size;
|
||||||
|
Loading…
Reference in New Issue
Block a user