Merge remote-tracking branch 'qatar/master'
* qatar/master: rtmpproto: Fix assignments in if() lavf: Fix assignments in if() svq1enc: Fix assignments in if() lavc: Fix assignments in if() when calling ff_af_queue_add h264: Fix assignments in if() truemotion2: cosmetics, reformat Conflicts: libavcodec/svq1enc.c libavcodec/truemotion2.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
57d59e82cb
@ -31,12 +31,29 @@
|
||||
|
||||
#define TM2_ESCAPE 0x80000000
|
||||
#define TM2_DELTAS 64
|
||||
|
||||
/* Huffman-coded streams of different types of blocks */
|
||||
enum TM2_STREAMS{ TM2_C_HI = 0, TM2_C_LO, TM2_L_HI, TM2_L_LO,
|
||||
TM2_UPD, TM2_MOT, TM2_TYPE, TM2_NUM_STREAMS};
|
||||
enum TM2_STREAMS {
|
||||
TM2_C_HI = 0,
|
||||
TM2_C_LO,
|
||||
TM2_L_HI,
|
||||
TM2_L_LO,
|
||||
TM2_UPD,
|
||||
TM2_MOT,
|
||||
TM2_TYPE,
|
||||
TM2_NUM_STREAMS
|
||||
};
|
||||
|
||||
/* Block types */
|
||||
enum TM2_BLOCKS{ TM2_HI_RES = 0, TM2_MED_RES, TM2_LOW_RES, TM2_NULL_RES,
|
||||
TM2_UPDATE, TM2_STILL, TM2_MOTION};
|
||||
enum TM2_BLOCKS {
|
||||
TM2_HI_RES = 0,
|
||||
TM2_MED_RES,
|
||||
TM2_LOW_RES,
|
||||
TM2_NULL_RES,
|
||||
TM2_UPDATE,
|
||||
TM2_STILL,
|
||||
TM2_MOTION
|
||||
};
|
||||
|
||||
typedef struct TM2Context {
|
||||
AVCodecContext *avctx;
|
||||
@ -95,7 +112,8 @@ static int tm2_read_tree(TM2Context *ctx, uint32_t prefix, int length, TM2Huff *
|
||||
{
|
||||
int ret;
|
||||
if (length > huff->max_bits) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Tree exceeded its given depth (%i)\n", huff->max_bits);
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Tree exceeded its given depth (%i)\n",
|
||||
huff->max_bits);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@ -135,12 +153,13 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
|
||||
/* check for correct codes parameters */
|
||||
if ((huff.val_bits < 1) || (huff.val_bits > 32) ||
|
||||
(huff.max_bits < 0) || (huff.max_bits > 25)) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n",
|
||||
huff.val_bits, huff.max_bits);
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal "
|
||||
"length: %i, max code length: %i\n", huff.val_bits, huff.max_bits);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if ((huff.nodes <= 0) || (huff.nodes > 0x10000)) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\n", huff.nodes);
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree "
|
||||
"nodes: %i\n", huff.nodes);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
/* one-node tree */
|
||||
@ -221,7 +240,8 @@ static inline int tm2_read_header(TM2Context *ctx, const uint8_t *buf)
|
||||
}
|
||||
}
|
||||
|
||||
static int tm2_read_deltas(TM2Context *ctx, int stream_id) {
|
||||
static int tm2_read_deltas(TM2Context *ctx, int stream_id)
|
||||
{
|
||||
int d, mb;
|
||||
int i, v;
|
||||
|
||||
@ -346,7 +366,8 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id, i
|
||||
return skip;
|
||||
}
|
||||
|
||||
static inline int GET_TOK(TM2Context *ctx,int type) {
|
||||
static inline int GET_TOK(TM2Context *ctx,int type)
|
||||
{
|
||||
if (ctx->tok_ptrs[type] >= ctx->tok_lens[type]) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Read token from stream %i out of bounds (%i>=%i)\n", type, ctx->tok_ptrs[type], ctx->tok_lens[type]);
|
||||
return 0;
|
||||
@ -625,8 +646,10 @@ static inline void tm2_update_block(TM2Context *ctx, AVFrame *pic, int bx, int b
|
||||
U[i] = Uo[i] + GET_TOK(ctx, TM2_UPD);
|
||||
V[i] = Vo[i] + GET_TOK(ctx, TM2_UPD);
|
||||
}
|
||||
U += Ustride; V += Vstride;
|
||||
Uo += oUstride; Vo += oVstride;
|
||||
U += Ustride;
|
||||
V += Vstride;
|
||||
Uo += oUstride;
|
||||
Vo += oVstride;
|
||||
}
|
||||
U -= Ustride * 2;
|
||||
V -= Vstride * 2;
|
||||
@ -677,8 +700,10 @@ static inline void tm2_motion_block(TM2Context *ctx, AVFrame *pic, int bx, int b
|
||||
U[i] = Uo[i];
|
||||
V[i] = Vo[i];
|
||||
}
|
||||
U += Ustride; V += Vstride;
|
||||
Uo += oUstride; Vo += oVstride;
|
||||
U += Ustride;
|
||||
V += Vstride;
|
||||
Uo += oUstride;
|
||||
Vo += oVstride;
|
||||
}
|
||||
U -= Ustride * 2;
|
||||
V -= Vstride * 2;
|
||||
@ -829,11 +854,12 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *got_frame,
|
||||
AVPacket *avpkt)
|
||||
{
|
||||
TM2Context * const l = avctx->priv_data;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size & ~3;
|
||||
TM2Context * const l = avctx->priv_data;
|
||||
AVFrame * const p = &l->pic;
|
||||
int i, offset = TM2_HEADER_SIZE, t, ret;
|
||||
int offset = TM2_HEADER_SIZE;
|
||||
int i, t, ret;
|
||||
|
||||
av_fast_padded_malloc(&l->buffer, &l->buffer_size, buf_size);
|
||||
if (!l->buffer) {
|
||||
@ -879,7 +905,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
static av_cold int decode_init(AVCodecContext *avctx){
|
||||
static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
TM2Context * const l = avctx->priv_data;
|
||||
int i, w = avctx->width, h = avctx->height;
|
||||
|
||||
@ -939,7 +966,8 @@ static av_cold int decode_init(AVCodecContext *avctx){
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_cold int decode_end(AVCodecContext *avctx){
|
||||
static av_cold int decode_end(AVCodecContext *avctx)
|
||||
{
|
||||
TM2Context * const l = avctx->priv_data;
|
||||
AVFrame *pic = &l->pic;
|
||||
int i;
|
||||
|
Loading…
Reference in New Issue
Block a user