23 #ifndef AVCODEC_SCPR_H 24 #define AVCODEC_SCPR_H 31 #include "bytestream.h" 54 uint32_t op_model[6][7];
55 uint32_t run_model[6][257];
56 uint32_t range_model[257];
57 uint32_t count_model[257];
58 uint32_t fill_model[6];
59 uint32_t sxy_model[4][17];
60 uint32_t mv_model[2][513];
76 int (*get_freq)(
RangeCoder *rc, uint32_t total_freq, uint32_t *freq);
80 static int decode_run_i(
AVCodecContext *avctx, uint32_t ptype,
int run,
81 int *px,
int *py, uint32_t clr, uint32_t *dst,
82 int linesize, uint32_t *plx, uint32_t *ply,
83 uint32_t backstep,
int off,
int *cx,
int *cx1)
92 if (y >= avctx->height)
98 dst[y * linesize + x] = clr;
102 if (x >= avctx->
width) {
105 if (y >= avctx->height && run)
112 dst[y * linesize + x] = dst[ly * linesize + lx];
116 if (x >= avctx->
width) {
119 if (y >= avctx->height && run)
123 clr = dst[ly * linesize + lx];
130 clr = dst[y * linesize + x + off + 1];
131 dst[y * linesize + x] = clr;
135 if (x >= avctx->
width) {
138 if (y >= avctx->height && run)
144 if (y < 1 || (y == 1 && x == 0))
148 uint8_t *odst = (uint8_t *)dst;
149 int off1 = (ly * linesize + lx) * 4;
150 int off2 = ((y * linesize + x) + off) * 4;
167 clr = ((b & 0xFF) << 16) + ((g & 0xFF) << 8) + (r & 0xFF);
168 dst[y * linesize + x] = clr;
172 if (x >= avctx->
width) {
175 if (y >= avctx->height && run)
181 if (y < 1 || (y == 1 && x == 0))
191 clr = dst[y * linesize + x + off - z];
192 dst[y * linesize + x] = clr;
196 if (x >= avctx->
width) {
199 if (y >= avctx->height && run)
212 *cx1 = (clr & 0x3F00) >> 2;
213 *cx = (clr & 0x3FFFFF) >> 16;
215 *cx1 = (clr & 0xFC00) >> 4;
216 *cx = (clr & 0xFFFFFF) >> 18;
222 static int decode_run_p(
AVCodecContext *avctx, uint32_t ptype,
int run,
223 int x,
int y, uint32_t clr,
224 uint32_t *dst, uint32_t *prev,
225 int linesize,
int plinesize,
226 uint32_t *bx, uint32_t *by,
227 uint32_t backstep,
int sx1,
int sx2,
236 if (*by >= avctx->height)
239 dst[*by * linesize + *bx] = clr;
241 if (*bx >= x * 16 + sx2 || *bx >= avctx->
width) {
257 if (*by >= avctx->height)
260 clr = dst[*by * linesize + *bx - 1 - z];
261 dst[*by * linesize + *bx] = clr;
263 if (*bx >= x * 16 + sx2 || *bx >= avctx->
width) {
271 if (*by < 1 || *by >= avctx->height)
274 clr = dst[(*by - 1) * linesize + *bx];
275 dst[*by * linesize + *bx] = clr;
277 if (*bx >= x * 16 + sx2 || *bx >= avctx->
width) {
285 if (*by >= avctx->height)
288 clr = prev[*by * plinesize + *bx];
289 dst[*by * linesize + *bx] = clr;
291 if (*bx >= x * 16 + sx2 || *bx >= avctx->
width) {
299 uint8_t *odst = (uint8_t *)dst;
301 if (*by < 1 || *by >= avctx->height)
312 r = odst[((*by - 1) * linesize + *bx) * 4] +
313 odst[(*by * linesize + *bx - 1 - z) * 4] -
314 odst[((*by - 1) * linesize + *bx - 1 - z) * 4];
315 g = odst[((*by - 1) * linesize + *bx) * 4 + 1] +
316 odst[(*by * linesize + *bx - 1 - z) * 4 + 1] -
317 odst[((*by - 1) * linesize + *bx - 1 - z) * 4 + 1];
318 b = odst[((*by - 1) * linesize + *bx) * 4 + 2] +
319 odst[(*by * linesize + *bx - 1 - z) * 4 + 2] -
320 odst[((*by - 1) * linesize + *bx - 1 - z) * 4 + 2];
321 clr = ((b & 0xFF) << 16) + ((g & 0xFF) << 8) + (r & 0xFF);
322 dst[*by * linesize + *bx] = clr;
324 if (*bx >= x * 16 + sx2 || *bx >= avctx->
width) {
332 if (*by < 1 || *by >= avctx->height)
343 clr = dst[(*by - 1) * linesize + *bx - 1 - z];
344 dst[*by * linesize + *bx] = clr;
346 if (*bx >= x * 16 + sx2 || *bx >= avctx->
width) {
355 *cx1 = (clr & 0x3F00) >> 2;
356 *cx = (clr & 0x3FFFFF) >> 16;
358 *cx1 = (clr & 0xFC00) >> 4;
359 *cx = (clr & 0xFFFFFF) >> 18;
Definition: bytestream.h:33
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
This structure describes decoded (raw) audio or video data.
Definition: frame.h:268
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:2776
int width
picture width / height.
Definition: avcodec.h:1729
Libavcodec external API header.
main external API structure.
Definition: avcodec.h:1556
common internal api header.