/*
* MSMPEG4 backend for ffmpeg encoder and decoder
- * Copyright (c) 2001 Fabrice Bellard.
+ * Copyright (c) 2001 Fabrice Bellard
* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
*
* msmpeg4v1 & v2 stuff by Michael Niedermayer <michaelni@gmx.at>
*/
/**
- * @file msmpeg4.c
+ * @file libavcodec/msmpeg4.c
* MSMPEG4 backend for ffmpeg encoder and decoder.
*/
static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
static void init_h263_dc_for_msmpeg4(void);
static inline void msmpeg4_memsetw(short *tab, int val, int n);
-#ifdef CONFIG_ENCODERS
+#if CONFIG_ENCODERS
static void msmpeg4v2_encode_motion(MpegEncContext * s, int val);
static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, int level, int intra);
#endif //CONFIG_ENCODERS
#include "msmpeg4data.h"
-#ifdef CONFIG_ENCODERS //strangely gcc includes this even if it is not references
+#if CONFIG_ENCODERS //strangely gcc includes this even if it is not referenced
static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2];
#endif //CONFIG_ENCODERS
static uint8_t static_rl_table_store[NB_RL_TABLES][2][2*MAX_RUN + MAX_LEVEL + 3];
-static void common_init(MpegEncContext * s)
+static av_cold void common_init(MpegEncContext * s)
{
static int initialized=0;
s->y_dc_scale_table= wmv1_y_dc_scale_table;
s->c_dc_scale_table= wmv1_c_dc_scale_table;
break;
-#if defined(CONFIG_WMV3_DECODER)||defined(CONFIG_VC1_DECODER)
+#if CONFIG_WMV3_DECODER || CONFIG_VC1_DECODER
case 6:
s->y_dc_scale_table= wmv3_dc_scale_table;
s->c_dc_scale_table= wmv3_dc_scale_table;
}
}
-#ifdef CONFIG_ENCODERS
+#if CONFIG_ENCODERS
/* build the table which associate a (x,y) motion vector to a vlc */
static void init_mv_table(MVTable *tab)
}
}
-void ff_msmpeg4_encode_init(MpegEncContext *s)
+av_cold void ff_msmpeg4_encode_init(MpegEncContext *s)
{
static int init_done=0;
int i;
return size;
}
-void ff_find_best_tables(MpegEncContext * s)
+static void find_best_tables(MpegEncContext * s)
{
int i;
int best =-1, best_size =9999999;
/* write MSMPEG4 compatible frame header */
void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
{
- ff_find_best_tables(s);
+ find_best_tables(s);
align_put_bits(&s->pb);
put_bits(&s->pb, 2, s->pict_type - 1);
return pred;
}
-#ifdef CONFIG_ENCODERS
+#if CONFIG_ENCODERS
void ff_msmpeg4_encode_motion(MpegEncContext * s,
int mx, int my)
necessitate to modify mpegvideo.c. The problem comes from the
fact they decided to store the quantized DC (which would lead
to problems if Q could vary !) */
-#if (defined(ARCH_X86)) && !defined PIC
- asm volatile(
+#if ARCH_X86 && !defined PIC
+ __asm__ volatile(
"movl %3, %%eax \n\t"
"shrl $1, %%eax \n\t"
"addl %%eax, %2 \n\t"
: "%eax", "%edx"
);
#else
- /* #elif defined (ARCH_ALPHA) */
+ /* #elif ARCH_ALPHA */
/* Divisions are extremely costly on Alpha; optimize the most
common case. But they are costly everywhere...
*/
/* This table is practically identical to the one from h263
* except that it is inverted. */
-static void init_h263_dc_for_msmpeg4(void)
+static av_cold void init_h263_dc_for_msmpeg4(void)
{
int level, uni_code, uni_len;
}
/* init all vlc decoding tables */
-int ff_msmpeg4_decode_init(MpegEncContext *s)
+av_cold int ff_msmpeg4_decode_init(MpegEncContext *s)
{
static int done = 0;
int i;
s->decode_mb= msmpeg4v34_decode_mb;
break;
case 5:
- if (ENABLE_WMV2_DECODER)
+ if (CONFIG_WMV2_DECODER)
s->decode_mb= ff_wmv2_decode_mb;
case 6:
//FIXME + TODO VC1 decode mb
tab[i] = val;
}
-#ifdef CONFIG_ENCODERS
+#if CONFIG_ENCODERS
static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
{
int range, bit_size, sign, code, bits;
int n, int coded, const uint8_t *scan_table)
{
int level, i, last, run, run_diff;
- int dc_pred_dir;
+ int av_uninit(dc_pred_dir);
RLTable *rl;
RL_VLC_ELEM *rl_vlc;
int qmul, qadd;