mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit '48e139409556861c9e561ce34133891d8eecc3cf'
* commit '48e139409556861c9e561ce34133891d8eecc3cf': mpeg4videodec: move MpegEncContext.resync_marker into Mpeg4DecContext. Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
ee9d53e572
@ -68,6 +68,8 @@ typedef struct Mpeg4DecContext {
|
|||||||
int vol_sprite_usage;
|
int vol_sprite_usage;
|
||||||
// reversible vlc
|
// reversible vlc
|
||||||
int rvlc;
|
int rvlc;
|
||||||
|
///< could this stream contain resync markers
|
||||||
|
int resync_marker;
|
||||||
} Mpeg4DecContext;
|
} Mpeg4DecContext;
|
||||||
|
|
||||||
/* dc encoding for mpeg4 */
|
/* dc encoding for mpeg4 */
|
||||||
|
@ -109,12 +109,13 @@ void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir)
|
|||||||
* check if the next stuff is a resync marker or the end.
|
* check if the next stuff is a resync marker or the end.
|
||||||
* @return 0 if not
|
* @return 0 if not
|
||||||
*/
|
*/
|
||||||
static inline int mpeg4_is_resync(MpegEncContext *s)
|
static inline int mpeg4_is_resync(Mpeg4DecContext *ctx)
|
||||||
{
|
{
|
||||||
|
MpegEncContext *s = &ctx->m;
|
||||||
int bits_count = get_bits_count(&s->gb);
|
int bits_count = get_bits_count(&s->gb);
|
||||||
int v = show_bits(&s->gb, 16);
|
int v = show_bits(&s->gb, 16);
|
||||||
|
|
||||||
if (s->workaround_bugs & FF_BUG_NO_PADDING && !s->resync_marker)
|
if (s->workaround_bugs & FF_BUG_NO_PADDING && !ctx->resync_marker)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while (v <= 0xFF) {
|
while (v <= 0xFF) {
|
||||||
@ -1268,12 +1269,12 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
|
|||||||
|
|
||||||
/* per-MB end of slice check */
|
/* per-MB end of slice check */
|
||||||
if (--s->mb_num_left <= 0) {
|
if (--s->mb_num_left <= 0) {
|
||||||
if (mpeg4_is_resync(s))
|
if (mpeg4_is_resync(ctx))
|
||||||
return SLICE_END;
|
return SLICE_END;
|
||||||
else
|
else
|
||||||
return SLICE_NOEND;
|
return SLICE_NOEND;
|
||||||
} else {
|
} else {
|
||||||
if (mpeg4_is_resync(s)) {
|
if (mpeg4_is_resync(ctx)) {
|
||||||
const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1;
|
const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1;
|
||||||
if (s->cbp_table[xy + delta])
|
if (s->cbp_table[xy + delta])
|
||||||
return SLICE_END;
|
return SLICE_END;
|
||||||
@ -1632,7 +1633,7 @@ intra:
|
|||||||
end:
|
end:
|
||||||
/* per-MB end of slice check */
|
/* per-MB end of slice check */
|
||||||
if (s->codec_id == AV_CODEC_ID_MPEG4) {
|
if (s->codec_id == AV_CODEC_ID_MPEG4) {
|
||||||
int next = mpeg4_is_resync(s);
|
int next = mpeg4_is_resync(ctx);
|
||||||
if (next) {
|
if (next) {
|
||||||
if (s->mb_x + s->mb_y*s->mb_width + 1 > next && (s->avctx->err_recognition & AV_EF_AGGRESSIVE)) {
|
if (s->mb_x + s->mb_y*s->mb_width + 1 > next && (s->avctx->err_recognition & AV_EF_AGGRESSIVE)) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -1968,7 +1969,7 @@ no_cplx_est:
|
|||||||
s->cplx_estimation_trash_b = 0;
|
s->cplx_estimation_trash_b = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->resync_marker = !get_bits1(gb); /* resync_marker_disabled */
|
ctx->resync_marker = !get_bits1(gb); /* resync_marker_disabled */
|
||||||
|
|
||||||
s->data_partitioning = get_bits1(gb);
|
s->data_partitioning = get_bits1(gb);
|
||||||
if (s->data_partitioning)
|
if (s->data_partitioning)
|
||||||
@ -2315,7 +2316,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
|||||||
s->pict_type == AV_PICTURE_TYPE_I ? "I" : (s->pict_type == AV_PICTURE_TYPE_P ? "P" : (s->pict_type == AV_PICTURE_TYPE_B ? "B" : "S")),
|
s->pict_type == AV_PICTURE_TYPE_I ? "I" : (s->pict_type == AV_PICTURE_TYPE_P ? "P" : (s->pict_type == AV_PICTURE_TYPE_B ? "B" : "S")),
|
||||||
gb->size_in_bits,s->progressive_sequence, s->alternate_scan,
|
gb->size_in_bits,s->progressive_sequence, s->alternate_scan,
|
||||||
s->top_field_first, s->quarter_sample ? "q" : "h",
|
s->top_field_first, s->quarter_sample ? "q" : "h",
|
||||||
s->data_partitioning, s->resync_marker,
|
s->data_partitioning, ctx->resync_marker,
|
||||||
s->num_sprite_warping_points, s->sprite_warping_accuracy,
|
s->num_sprite_warping_points, s->sprite_warping_accuracy,
|
||||||
1 - s->no_rounding, s->vo_type,
|
1 - s->no_rounding, s->vo_type,
|
||||||
s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold,
|
s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold,
|
||||||
|
@ -615,7 +615,6 @@ typedef struct MpegEncContext {
|
|||||||
int low_latency_sprite;
|
int low_latency_sprite;
|
||||||
int data_partitioning; ///< data partitioning flag from header
|
int data_partitioning; ///< data partitioning flag from header
|
||||||
int partitioned_frame; ///< is current frame partitioned
|
int partitioned_frame; ///< is current frame partitioned
|
||||||
int resync_marker; ///< could this stream contain resync markers
|
|
||||||
int low_delay; ///< no reordering needed / has no b-frames
|
int low_delay; ///< no reordering needed / has no b-frames
|
||||||
int vo_type;
|
int vo_type;
|
||||||
int vol_control_parameters; ///< does the stream contain the low_delay flag, used to workaround buggy encoders
|
int vol_control_parameters; ///< does the stream contain the low_delay flag, used to workaround buggy encoders
|
||||||
|
@ -72,7 +72,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
|
|||||||
pic_param->vol_fields.bits.quarter_sample = s->quarter_sample;
|
pic_param->vol_fields.bits.quarter_sample = s->quarter_sample;
|
||||||
pic_param->vol_fields.bits.data_partitioned = s->data_partitioning;
|
pic_param->vol_fields.bits.data_partitioned = s->data_partitioning;
|
||||||
pic_param->vol_fields.bits.reversible_vlc = ctx->rvlc;
|
pic_param->vol_fields.bits.reversible_vlc = ctx->rvlc;
|
||||||
pic_param->vol_fields.bits.resync_marker_disable = !s->resync_marker;
|
pic_param->vol_fields.bits.resync_marker_disable = !ctx->resync_marker;
|
||||||
pic_param->no_of_sprite_warping_points = s->num_sprite_warping_points;
|
pic_param->no_of_sprite_warping_points = s->num_sprite_warping_points;
|
||||||
for (i = 0; i < s->num_sprite_warping_points && i < 3; i++) {
|
for (i = 0; i < s->num_sprite_warping_points && i < 3; i++) {
|
||||||
pic_param->sprite_trajectory_du[i] = s->sprite_traj[i][0];
|
pic_param->sprite_trajectory_du[i] = s->sprite_traj[i][0];
|
||||||
|
@ -345,7 +345,7 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
|||||||
render->info.vc1.range_mapuv = v->range_mapuv;
|
render->info.vc1.range_mapuv = v->range_mapuv;
|
||||||
/* Specific to simple/main profile only */
|
/* Specific to simple/main profile only */
|
||||||
render->info.vc1.multires = v->multires;
|
render->info.vc1.multires = v->multires;
|
||||||
render->info.vc1.syncmarker = v->s.resync_marker;
|
render->info.vc1.syncmarker = v->resync_marker;
|
||||||
render->info.vc1.rangered = v->rangered | (v->rangeredfrm << 1);
|
render->info.vc1.rangered = v->rangered | (v->rangeredfrm << 1);
|
||||||
render->info.vc1.maxbframes = v->s.max_b_frames;
|
render->info.vc1.maxbframes = v->s.max_b_frames;
|
||||||
|
|
||||||
@ -383,9 +383,10 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
|||||||
#endif /* (CONFIG_VC1_VDPAU_DECODER */
|
#endif /* (CONFIG_VC1_VDPAU_DECODER */
|
||||||
|
|
||||||
#if CONFIG_MPEG4_VDPAU_DECODER
|
#if CONFIG_MPEG4_VDPAU_DECODER
|
||||||
void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *ctx, const uint8_t *buf,
|
||||||
int buf_size)
|
int buf_size)
|
||||||
{
|
{
|
||||||
|
MpegEncContext *s = &ctx->m;
|
||||||
struct vdpau_render_state *render, *last, *next;
|
struct vdpau_render_state *render, *last, *next;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -403,7 +404,7 @@ void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
|||||||
render->info.mpeg4.vop_coding_type = 0;
|
render->info.mpeg4.vop_coding_type = 0;
|
||||||
render->info.mpeg4.vop_fcode_forward = s->f_code;
|
render->info.mpeg4.vop_fcode_forward = s->f_code;
|
||||||
render->info.mpeg4.vop_fcode_backward = s->b_code;
|
render->info.mpeg4.vop_fcode_backward = s->b_code;
|
||||||
render->info.mpeg4.resync_marker_disable = !s->resync_marker;
|
render->info.mpeg4.resync_marker_disable = !ctx->resync_marker;
|
||||||
render->info.mpeg4.interlaced = !s->progressive_sequence;
|
render->info.mpeg4.interlaced = !s->progressive_sequence;
|
||||||
render->info.mpeg4.quant_type = s->mpeg_quant;
|
render->info.mpeg4.quant_type = s->mpeg_quant;
|
||||||
render->info.mpeg4.quarter_sample = s->quarter_sample;
|
render->info.mpeg4.quarter_sample = s->quarter_sample;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "h264.h"
|
#include "h264.h"
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
|
#include "mpeg4video.h"
|
||||||
#include "mpegvideo.h"
|
#include "mpegvideo.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ void ff_vdpau_h264_picture_complete(H264Context *h);
|
|||||||
void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
||||||
int buf_size);
|
int buf_size);
|
||||||
|
|
||||||
void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *s, const uint8_t *buf,
|
||||||
int buf_size);
|
int buf_size);
|
||||||
|
|
||||||
#endif /* AVCODEC_VDPAU_INTERNAL_H */
|
#endif /* AVCODEC_VDPAU_INTERNAL_H */
|
||||||
|
@ -24,13 +24,15 @@
|
|||||||
#include <vdpau/vdpau.h>
|
#include <vdpau/vdpau.h>
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
|
#include "mpeg4video.h"
|
||||||
#include "vdpau.h"
|
#include "vdpau.h"
|
||||||
#include "vdpau_internal.h"
|
#include "vdpau_internal.h"
|
||||||
|
|
||||||
static int vdpau_mpeg4_start_frame(AVCodecContext *avctx,
|
static int vdpau_mpeg4_start_frame(AVCodecContext *avctx,
|
||||||
const uint8_t *buffer, uint32_t size)
|
const uint8_t *buffer, uint32_t size)
|
||||||
{
|
{
|
||||||
MpegEncContext * const s = avctx->priv_data;
|
Mpeg4DecContext *ctx = avctx->priv_data;
|
||||||
|
MpegEncContext * const s = &ctx->m;
|
||||||
Picture *pic = s->current_picture_ptr;
|
Picture *pic = s->current_picture_ptr;
|
||||||
struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
|
struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
|
||||||
VdpPictureInfoMPEG4Part2 *info = &pic_ctx->info.mpeg4;
|
VdpPictureInfoMPEG4Part2 *info = &pic_ctx->info.mpeg4;
|
||||||
@ -62,7 +64,7 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx,
|
|||||||
info->vop_time_increment_resolution = s->avctx->time_base.den;
|
info->vop_time_increment_resolution = s->avctx->time_base.den;
|
||||||
info->vop_fcode_forward = s->f_code;
|
info->vop_fcode_forward = s->f_code;
|
||||||
info->vop_fcode_backward = s->b_code;
|
info->vop_fcode_backward = s->b_code;
|
||||||
info->resync_marker_disable = !s->resync_marker;
|
info->resync_marker_disable = !ctx->resync_marker;
|
||||||
info->interlaced = !s->progressive_sequence;
|
info->interlaced = !s->progressive_sequence;
|
||||||
info->quant_type = s->mpeg_quant;
|
info->quant_type = s->mpeg_quant;
|
||||||
info->quarter_sample = s->quarter_sample;
|
info->quarter_sample = s->quarter_sample;
|
||||||
|
Loading…
Reference in New Issue
Block a user