mirror of https://git.ffmpeg.org/ffmpeg.git
Merge commit '95a8a03a191204c3ca5c8cf6b69ab166765d5ff3'
* commit '95a8a03a191204c3ca5c8cf6b69ab166765d5ff3': Add FM Screen Capture Codec decoder Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
commit
b94eda7194
|
@ -44,11 +44,11 @@ typedef struct FMVCContext {
|
|||
size_t buffer_size;
|
||||
uint8_t *pbuffer;
|
||||
size_t pbuffer_size;
|
||||
int stride;
|
||||
ptrdiff_t stride;
|
||||
int bpp;
|
||||
int yb, xb;
|
||||
InterBlock *blocks;
|
||||
int nb_blocks;
|
||||
unsigned nb_blocks;
|
||||
} FMVCContext;
|
||||
|
||||
static int decode_type2(GetByteContext *gb, PutByteContext *pb)
|
||||
|
@ -305,7 +305,7 @@ static int decode_type1(GetByteContext *gb, PutByteContext *pb)
|
|||
break;
|
||||
opcode = bytestream2_get_byte(gb);
|
||||
if (opcode < 0xF8) {
|
||||
opcode = opcode + 32;
|
||||
opcode += 32;
|
||||
break;
|
||||
}
|
||||
i = opcode - 0xF8;
|
||||
|
@ -393,9 +393,8 @@ static int decode_type1(GetByteContext *gb, PutByteContext *pb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *got_frame,
|
||||
AVPacket *avpkt)
|
||||
static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
FMVCContext *s = avctx->priv_data;
|
||||
GetByteContext *gb = &s->gb;
|
||||
|
@ -414,7 +413,7 @@ static int decode_frame(AVCodecContext *avctx,
|
|||
|
||||
if (frame->key_frame) {
|
||||
const uint8_t *src;
|
||||
int type, size;
|
||||
unsigned type, size;
|
||||
uint8_t *dst;
|
||||
|
||||
type = bytestream2_get_le16(gb);
|
||||
|
@ -428,7 +427,7 @@ static int decode_frame(AVCodecContext *avctx,
|
|||
} else if (type == 2){
|
||||
decode_type2(gb, pb);
|
||||
} else {
|
||||
avpriv_report_missing_feature(avctx, "compression %d", type);
|
||||
avpriv_report_missing_feature(avctx, "Compression type %d", type);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
|
@ -440,7 +439,8 @@ static int decode_frame(AVCodecContext *avctx,
|
|||
src += s->stride * 4;
|
||||
}
|
||||
} else {
|
||||
int block, nb_blocks, type, k, l;
|
||||
unsigned block, nb_blocks;
|
||||
int type, k, l;
|
||||
uint8_t *ssrc, *ddst;
|
||||
const uint32_t *src;
|
||||
uint32_t *dst;
|
||||
|
@ -456,7 +456,8 @@ static int decode_frame(AVCodecContext *avctx,
|
|||
|
||||
type = bytestream2_get_le16(gb);
|
||||
for (block = 0; block < nb_blocks; block++) {
|
||||
int size, offset, start = 0;
|
||||
unsigned size, offset;
|
||||
int start = 0;
|
||||
|
||||
offset = bytestream2_get_le16(gb);
|
||||
if (offset >= s->nb_blocks)
|
||||
|
@ -472,7 +473,7 @@ static int decode_frame(AVCodecContext *avctx,
|
|||
} else if (type == 2){
|
||||
decode_type2(gb, pb);
|
||||
} else {
|
||||
avpriv_report_missing_feature(avctx, "compression %d", type);
|
||||
avpriv_report_missing_feature(avctx, "Compression type %d", type);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
|
@ -497,9 +498,8 @@ static int decode_frame(AVCodecContext *avctx,
|
|||
if (s->blocks[block].xor) {
|
||||
for (k = 0; k < block_h; k++) {
|
||||
uint32_t *column = dst;
|
||||
for (l = 0; l < block_w; l++) {
|
||||
for (l = 0; l < block_w; l++)
|
||||
*dst++ ^= *src++;
|
||||
}
|
||||
dst = &column[s->stride];
|
||||
}
|
||||
}
|
||||
|
@ -529,11 +529,18 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||
int i, j, m, block = 0, h = BLOCK_HEIGHT, w = BLOCK_WIDTH;
|
||||
|
||||
switch (avctx->bits_per_coded_sample) {
|
||||
case 16: avctx->pix_fmt = AV_PIX_FMT_RGB555; break;
|
||||
case 24: avctx->pix_fmt = AV_PIX_FMT_BGR24; break;
|
||||
case 32: avctx->pix_fmt = AV_PIX_FMT_BGRA; break;
|
||||
case 16:
|
||||
avctx->pix_fmt = AV_PIX_FMT_RGB555;
|
||||
break;
|
||||
case 24:
|
||||
avctx->pix_fmt = AV_PIX_FMT_BGR24;
|
||||
break;
|
||||
case 32:
|
||||
avctx->pix_fmt = AV_PIX_FMT_BGRA;
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unsupported bitdepth %i\n", avctx->bits_per_coded_sample);
|
||||
av_log(avctx, AV_LOG_ERROR, "Unsupported bitdepth %i\n",
|
||||
avctx->bits_per_coded_sample);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
@ -563,7 +570,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||
s->nb_blocks = s->xb * s->yb;
|
||||
if (!s->nb_blocks)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
s->blocks = av_calloc(s->nb_blocks, sizeof(*s->blocks));
|
||||
if (!s->blocks)
|
||||
return AVERROR(ENOMEM);
|
||||
|
|
Loading…
Reference in New Issue