* h263 bitstream encoder.
*/
-//#define DEBUG
#include <limits.h>
-#include "dsputil.h"
+#include "libavutil/attributes.h"
#include "avcodec.h"
#include "mpegvideo.h"
#include "h263.h"
#include "mathops.h"
+#include "mpegutils.h"
#include "unary.h"
#include "flv.h"
#include "mpeg4video.h"
#include "internal.h"
-//#undef NDEBUG
-//#include <assert.h>
-
/**
* Table of number of bits a motion vector component needs.
*/
*/
void ff_clean_h263_qscales(MpegEncContext *s){
int i;
- int8_t * const qscale_table = s->current_picture.f.qscale_table;
+ int8_t * const qscale_table = s->current_picture.qscale_table;
ff_init_qscale_tab(s);
* @param block the 8x8 block
* @param n block index (0-3 are luma, 4-5 are chroma)
*/
-static void h263_encode_block(MpegEncContext * s, DCTELEM * block, int n)
+static void h263_encode_block(MpegEncContext * s, int16_t * block, int n)
{
int level, run, last, i, j, last_index, last_non_zero, sign, slevel, code;
RLTable *rl;
}
void ff_h263_encode_mb(MpegEncContext * s,
- DCTELEM block[6][64],
+ int16_t block[6][64],
int motion_x, int motion_y)
{
int cbpc, cbpy, i, cbp, pred_x, pred_y;
/* motion vectors: 8x8 mode*/
ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y);
- motion_x = s->current_picture.f.motion_val[0][s->block_index[i]][0];
- motion_y = s->current_picture.f.motion_val[0][s->block_index[i]][1];
+ motion_x = s->current_picture.motion_val[0][s->block_index[i]][0];
+ motion_y = s->current_picture.motion_val[0][s->block_index[i]][1];
if (!s->umvplus) {
ff_h263_encode_motion_vector(s, motion_x - pred_x,
motion_y - pred_y, 1);
else
level = (level - (scale>>1))/scale;
- /* AIC can change CBP */
- if (level == 0 && s->block_last_index[i] == 0)
- s->block_last_index[i] = -1;
-
if(!s->modified_quant){
if (level < -127)
level = -127;
/* Update AC/DC tables */
*dc_ptr[i] = rec_intradc[i];
- if (s->block_last_index[i] >= 0)
+ /* AIC can change CBP */
+ if (s->block_last_index[i] > 0 ||
+ (s->block_last_index[i] == 0 && level !=0))
cbp |= 1 << (5 - i);
}
}else{
}
}
-static void init_mv_penalty_and_fcode(MpegEncContext *s)
+static av_cold void init_mv_penalty_and_fcode(MpegEncContext *s)
{
int f_code;
int mv;
}
}
-static void init_uni_h263_rl_tab(RLTable *rl, uint32_t *bits_tab, uint8_t *len_tab){
+static av_cold void init_uni_h263_rl_tab(RLTable *rl, uint32_t *bits_tab,
+ uint8_t *len_tab)
+{
int slevel, run, last;
assert(MAX_LEVEL >= 64);
}
}
-void ff_h263_encode_init(MpegEncContext *s)
+av_cold void ff_h263_encode_init(MpegEncContext *s)
{
static int done = 0;