int i, level, nCoeffs;
const uint16_t *quant_matrix;
+ if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
+ else qscale <<= 1;
+
if(s->alternate_scan) nCoeffs= 63;
else nCoeffs= s->block_last_index[n];
if (level) {
if (level < 0) {
level = -level;
- level = (int)(level * qscale * quant_matrix[j]) >> 3;
+ level = (int)(level * qscale * quant_matrix[j]) >> 4;
level = -level;
} else {
- level = (int)(level * qscale * quant_matrix[j]) >> 3;
+ level = (int)(level * qscale * quant_matrix[j]) >> 4;
}
block[j] = level;
}
const uint16_t *quant_matrix;
int sum=-1;
+ if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
+ else qscale <<= 1;
+
if(s->alternate_scan) nCoeffs= 63;
else nCoeffs= s->block_last_index[n];
if (level) {
if (level < 0) {
level = -level;
- level = (int)(level * qscale * quant_matrix[j]) >> 3;
+ level = (int)(level * qscale * quant_matrix[j]) >> 4;
level = -level;
} else {
- level = (int)(level * qscale * quant_matrix[j]) >> 3;
+ level = (int)(level * qscale * quant_matrix[j]) >> 4;
}
block[j] = level;
sum+=level;
const uint16_t *quant_matrix;
int sum=-1;
+ if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
+ else qscale <<= 1;
+
if(s->alternate_scan) nCoeffs= 63;
else nCoeffs= s->block_last_index[n];
if (level < 0) {
level = -level;
level = (((level << 1) + 1) * qscale *
- ((int) (quant_matrix[j]))) >> 4;
+ ((int) (quant_matrix[j]))) >> 5;
level = -level;
} else {
level = (((level << 1) + 1) * qscale *
- ((int) (quant_matrix[j]))) >> 4;
+ ((int) (quant_matrix[j]))) >> 5;
}
block[j] = level;
sum+=level;
if (s1->bitstream_buffer) {
if (s1->bitstream_buffer_size +
- FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size) {
+ AV_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size) {
av_fast_malloc(&s->bitstream_buffer,
&s->allocated_bitstream_buffer_size,
s1->allocated_bitstream_buffer_size);
memcpy(s->bitstream_buffer, s1->bitstream_buffer,
s1->bitstream_buffer_size);
memset(s->bitstream_buffer + s->bitstream_buffer_size, 0,
- FF_INPUT_BUFFER_PADDING_SIZE);
+ AV_INPUT_BUFFER_PADDING_SIZE);
}
// linesize dependend scratch buffer allocation
s->parse_context.buffer = NULL;
s->parse_context.buffer_size = 0;
+ s->parse_context.overread = 0;
s->bitstream_buffer = NULL;
s->allocated_bitstream_buffer_size = 0;
s->picture = NULL;
if (&s->picture[i] != s->last_picture_ptr &&
&s->picture[i] != s->next_picture_ptr &&
s->picture[i].reference && !s->picture[i].needs_realloc) {
- if (!(avctx->active_thread_type & FF_THREAD_FRAME))
- av_log(avctx, AV_LOG_ERROR,
- "releasing zombie picture\n");
ff_mpeg_unref_picture(s->avctx, &s->picture[i]);
}
}
return -1;
}
- if (!avctx->hwaccel && !(avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)) {
+ if (!avctx->hwaccel
+#if FF_API_CAP_VDPAU
+ && !(avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU)
+#endif
+ ) {
for(i=0; i<avctx->height; i++)
memset(s->last_picture_ptr->f->data[0] + s->last_picture_ptr->f->linesize[0]*i,
0x80, avctx->width);
static int add_mb(AVMotionVector *mb, uint32_t mb_type,
int dst_x, int dst_y,
- int src_x, int src_y,
+ int motion_x, int motion_y, int motion_scale,
int direction)
{
mb->w = IS_8X8(mb_type) || IS_8X16(mb_type) ? 8 : 16;
mb->h = IS_8X8(mb_type) || IS_16X8(mb_type) ? 8 : 16;
- mb->src_x = src_x;
- mb->src_y = src_y;
+ mb->motion_x = motion_x;
+ mb->motion_y = motion_y;
+ mb->motion_scale = motion_scale;
mb->dst_x = dst_x;
mb->dst_y = dst_y;
+ mb->src_x = dst_x + motion_x / motion_scale;
+ mb->src_y = dst_y + motion_y / motion_scale;
mb->source = direction ? 1 : -1;
mb->flags = 0; // XXX: does mb_type contain extra information that could be exported here?
return 1;
{
if ((avctx->flags2 & AV_CODEC_FLAG2_EXPORT_MVS) && mbtype_table && motion_val[0]) {
const int shift = 1 + quarter_sample;
+ const int scale = 1 << shift;
const int mv_sample_log2 = avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_SVQ3 ? 2 : 1;
const int mv_stride = (mb_width << mv_sample_log2) +
(avctx->codec->id == AV_CODEC_ID_H264 ? 0 : 1);
int sy = mb_y * 16 + 4 + 8 * (i >> 1);
int xy = (mb_x * 2 + (i & 1) +
(mb_y * 2 + (i >> 1)) * mv_stride) << (mv_sample_log2 - 1);
- int mx = (motion_val[direction][xy][0] >> shift) + sx;
- int my = (motion_val[direction][xy][1] >> shift) + sy;
- mbcount += add_mb(mvs + mbcount, mb_type, sx, sy, mx, my, direction);
+ int mx = motion_val[direction][xy][0];
+ int my = motion_val[direction][xy][1];
+ mbcount += add_mb(mvs + mbcount, mb_type, sx, sy, mx, my, scale, direction);
}
} else if (IS_16X8(mb_type)) {
for (i = 0; i < 2; i++) {
int sx = mb_x * 16 + 8;
int sy = mb_y * 16 + 4 + 8 * i;
int xy = (mb_x * 2 + (mb_y * 2 + i) * mv_stride) << (mv_sample_log2 - 1);
- int mx = (motion_val[direction][xy][0] >> shift);
- int my = (motion_val[direction][xy][1] >> shift);
+ int mx = motion_val[direction][xy][0];
+ int my = motion_val[direction][xy][1];
if (IS_INTERLACED(mb_type))
my *= 2;
- mbcount += add_mb(mvs + mbcount, mb_type, sx, sy, mx + sx, my + sy, direction);
+ mbcount += add_mb(mvs + mbcount, mb_type, sx, sy, mx, my, scale, direction);
}
} else if (IS_8X16(mb_type)) {
for (i = 0; i < 2; i++) {
int sx = mb_x * 16 + 4 + 8 * i;
int sy = mb_y * 16 + 8;
int xy = (mb_x * 2 + i + mb_y * 2 * mv_stride) << (mv_sample_log2 - 1);
- int mx = motion_val[direction][xy][0] >> shift;
- int my = motion_val[direction][xy][1] >> shift;
+ int mx = motion_val[direction][xy][0];
+ int my = motion_val[direction][xy][1];
if (IS_INTERLACED(mb_type))
my *= 2;
- mbcount += add_mb(mvs + mbcount, mb_type, sx, sy, mx + sx, my + sy, direction);
+ mbcount += add_mb(mvs + mbcount, mb_type, sx, sy, mx, my, scale, direction);
}
} else {
int sx = mb_x * 16 + 8;
int sy = mb_y * 16 + 8;
int xy = (mb_x + mb_y * mv_stride) << mv_sample_log2;
- int mx = (motion_val[direction][xy][0]>>shift) + sx;
- int my = (motion_val[direction][xy][1]>>shift) + sy;
- mbcount += add_mb(mvs + mbcount, mb_type, sx, sy, mx, my, direction);
+ int mx = motion_val[direction][xy][0];
+ int my = motion_val[direction][xy][1];
+ mbcount += add_mb(mvs + mbcount, mb_type, sx, sy, mx, my, scale, direction);
}
}
}
/* TODO: export all the following to make them accessible for users (and filters) */
if (avctx->hwaccel || !mbtype_table
- || (avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU))
+#if FF_API_CAP_VDPAU
+ || (avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU)
+#endif
+ )
return;
uint64_t u,v;
int y;
#define COLOR(theta, r) \
- u = (int)(128 + r * cos(theta * 3.141592 / 180)); \
- v = (int)(128 + r * sin(theta * 3.141592 / 180));
+ u = (int)(128 + r * cos(theta * M_PI / 180)); \
+ v = (int)(128 + r * sin(theta * M_PI / 180));
u = v = 128;