41 int nb_tiles = bytestream2_get_le16(gb);
43 int pixels_overwritten = 0;
45 if ((avctx->
width / 4 + 1) * (avctx->
height / 4 + 1) < nb_tiles)
48 for (
int i = 0;
i < nb_tiles;
i++) {
49 int y = bytestream2_get_byte(gb);
50 int x = bytestream2_get_byte(gb);
51 uint16_t
mask = bytestream2_get_le16(gb);
52 int start_y = y * 4, start_x = x * 4;
53 int end_y = start_y + 4, end_x = start_x + 4;
55 for (
int j = start_y; j < end_y; j++) {
56 for (
int k = start_x; k < end_x; k++) {
63 pixels_overwritten ++;
69 return pixels_overwritten;
77 const int step_h = tile_height / 4;
78 const int step_w = tile_width / 4;
79 int nb_tiles = bytestream2_get_le16(gb);
81 int pixels_overwritten = 0;
83 if ((avctx->
width / tile_width + 1) * (avctx->
height / tile_height + 1) < nb_tiles)
86 for (
int i = 0;
i < nb_tiles;
i++) {
87 int y = bytestream2_get_byte(gb);
88 int x = bytestream2_get_byte(gb);
89 uint16_t
mask = bytestream2_get_le16(gb);
90 int start_y = y * tile_height, start_x = x * tile_width;
91 int end_y = start_y + tile_height, end_x = start_x + tile_width;
93 if (start_x >= avctx->
width || start_y >= avctx->
height)
96 for (
int j = start_y; j < end_y; j += step_h) {
97 for (
int k = start_x; k < end_x; k += step_w) {
99 for (
int m = 0; m < step_h; m++) {
100 for (
int n = 0; n < step_w; n++) {
101 if (j + m >= avctx->
height || k + n >= avctx->
width)
112 return pixels_overwritten;
119 int ret, nb_segments;
122 if (avpkt->
size < 10)
127 nb_segments = bytestream2_get_le16(&
s->gb);
128 if (nb_segments == 0)
137 if (
s->prev_frame->data[0]) {
143 for (
int i = 0;
i < nb_segments;
i++) {
150 fill = bytestream2_get_byte(&
s->gb) << 16;
152 fill |= bytestream2_get_byte(&
s->gb) << 8;
154 fill |= bytestream2_get_byte(&
s->gb) << 0;
156 resolution_flag = bytestream2_get_byte(&
s->gb);
158 if (resolution_flag & 0x10)
160 if (resolution_flag & 0x08)
162 if (resolution_flag & 0x04)
164 if (resolution_flag & 0x02)
166 if (resolution_flag & 0x01)
174 if (prev_pixels <= 0)
static av_cold void decode_flush(AVCodecContext *avctx)
const FFCodec ff_arbc_decoder
static av_cold void decode_flush(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
static av_cold int decode_close(AVCodecContext *avctx)
static int fill_tileX(AVCodecContext *avctx, int tile_width, int tile_height, int color, AVFrame *frame)
static av_cold int decode_init(AVCodecContext *avctx)
static int fill_tile4(AVCodecContext *avctx, int color, AVFrame *frame)
Libavcodec external API header.
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int av_frame_replace(AVFrame *dst, const AVFrame *src)
Ensure the destination frame refers to the same data described by the source frame,...
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_P
Predicted.
static av_cold int decode_init(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
static av_cold int decode_close(AVCodecContext *avctx)
Macro definitions for various function/variable attributes.
common internal API header
static const uint16_t mask[17]
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.