#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "error_resilience.h"
-#include "hwaccel.h"
+#include "hwconfig.h"
#include "idctdsp.h"
#include "internal.h"
#include "mpegutils.h"
int i;
do {
- if (show_bits_long(&s->gb, 19) == DC_MARKER)
+ if (show_bits(&s->gb, 19) == DC_MARKER)
return mb_num - 1;
cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
if (s->pict_type == AV_PICTURE_TYPE_I) {
while (show_bits(&s->gb, 9) == 1)
skip_bits(&s->gb, 9);
- if (get_bits_long(&s->gb, 19) != DC_MARKER) {
+ if (get_bits(&s->gb, 19) != DC_MARKER) {
av_log(s->avctx, AV_LOG_ERROR,
"marker missing after first I partition at %d %d\n",
s->mb_x, s->mb_y);
{
align_get_bits(gb);
- while (get_bits_left(gb) >= 24 && show_bits_long(gb, 24) != 0x1) {
+ while (get_bits_left(gb) >= 24 && show_bits(gb, 24) != 0x1) {
get_bits(gb, 8);
}
}
uint32_t flc;
const int min = -1 * (1 << (s->avctx->bits_per_raw_sample + 6));
const int max = ((1 << (s->avctx->bits_per_raw_sample + 6)) - 1);
+ int shift = 3 - s->dct_precision;
mismatch = 1;
else
block[j] = flc;
}
- block[j] = ((8 * 2 * block[j] * quant_matrix[j] * s->qscale) >> s->dct_precision) / 32;
+ block[j] = ((block[j] * quant_matrix[j] * s->qscale) * (1 << shift)) / 16;
block[j] = av_clip(block[j], min, max);
mismatch ^= block[j];
}
* Decode MPEG-4 headers.
*
* @param header If set the absence of a VOP is not treated as error; otherwise, it is treated as such.
- * @return <0 if an error occured
+ * @return <0 if an error occurred
* FRAME_SKIPPED if a not coded VOP is found
* 0 else
*/
if (ret < 0)
return ret;
- memcpy(((uint8_t*)s) + sizeof(MpegEncContext), ((uint8_t*)s1) + sizeof(MpegEncContext), sizeof(Mpeg4DecContext) - sizeof(MpegEncContext));
+ // copy all the necessary fields explicitly
+ s->time_increment_bits = s1->time_increment_bits;
+ s->shape = s1->shape;
+ s->vol_sprite_usage = s1->vol_sprite_usage;
+ s->sprite_brightness_change = s1->sprite_brightness_change;
+ s->num_sprite_warping_points = s1->num_sprite_warping_points;
+ s->rvlc = s1->rvlc;
+ s->resync_marker = s1->resync_marker;
+ s->t_frame = s1->t_frame;
+ s->new_pred = s1->new_pred;
+ s->enhancement_type = s1->enhancement_type;
+ s->scalability = s1->scalability;
+ s->use_intra_dc_vlc = s1->use_intra_dc_vlc;
+ s->intra_dc_threshold = s1->intra_dc_threshold;
+ s->divx_version = s1->divx_version;
+ s->divx_build = s1->divx_build;
+ s->xvid_build = s1->xvid_build;
+ s->lavc_build = s1->lavc_build;
+ s->showed_packed_warning = s1->showed_packed_warning;
+ s->vol_control_parameters = s1->vol_control_parameters;
+ s->cplx_estimation_trash_i = s1->cplx_estimation_trash_i;
+ s->cplx_estimation_trash_p = s1->cplx_estimation_trash_p;
+ s->cplx_estimation_trash_b = s1->cplx_estimation_trash_b;
+ s->rgb = s1->rgb;
+
+ memcpy(s->sprite_shift, s1->sprite_shift, sizeof(s1->sprite_shift));
+ memcpy(s->sprite_traj, s1->sprite_traj, sizeof(s1->sprite_traj));
if (CONFIG_MPEG4_DECODER && !init && s1->xvid_build >= 0)
ff_xvid_idct_init(&s->m.idsp, dst);
ctx->time_increment_bits = 4; /* default value for broken headers */
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
- avctx->internal->allocate_progress = 1;
return 0;
}
Mpeg4DecContext *ctx = avctx->priv_data;
int i;
- if (!avctx->internal->is_copy) {
- for (i = 0; i < 12; i++)
- ff_free_vlc(&ctx->studio_intra_tab[i]);
+ for (i = 0; i < 12; i++)
+ ff_free_vlc(&ctx->studio_intra_tab[i]);
- ff_free_vlc(&ctx->studio_luma_dc);
- ff_free_vlc(&ctx->studio_chroma_dc);
- }
+ ff_free_vlc(&ctx->studio_luma_dc);
+ ff_free_vlc(&ctx->studio_chroma_dc);
return ff_h263_decode_end(avctx);
}
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_FRAME_THREADS,
- .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
+ .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM |
+ FF_CODEC_CAP_ALLOCATE_PROGRESS,
.flush = ff_mpeg_flush,
.max_lowres = 3,
.pix_fmts = ff_h263_hwaccel_pixfmt_list_420,