#include "mathops.h"
#include "mpeg12.h"
#include "mpeg12data.h"
+#include "mpegutils.h"
#include "mpegvideo.h"
{
MpegEncContext *s = avctx->priv_data;
- if (ff_MPV_encode_init(avctx) < 0)
+ if (ff_mpv_encode_init(avctx) < 0)
return -1;
if (find_frame_rate_index(s) < 0) {
return -1;
}
+#if FF_API_PRIVATE_OPT
+FF_DISABLE_DEPRECATION_WARNINGS
+ if (avctx->timecode_frame_start)
+ s->timecode_frame_start = avctx->timecode_frame_start;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
return 0;
}
put_bits(&s->pb, 1, s->low_delay);
put_bits(&s->pb, 2, 0); // frame_rate_ext_n
put_bits(&s->pb, 5, 0); // frame_rate_ext_d
+
+ put_header(s, EXT_START_CODE);
+ put_bits(&s->pb, 4, 2); // sequence display extension
+ put_bits(&s->pb, 3, 0); // video_format: 0 is components
+ put_bits(&s->pb, 1, 1); // colour_description
+ put_bits(&s->pb, 8, s->avctx->color_primaries); // colour_primaries
+ put_bits(&s->pb, 8, s->avctx->color_trc); // transfer_characteristics
+ put_bits(&s->pb, 8, s->avctx->colorspace); // matrix_coefficients
+ put_bits(&s->pb, 14, s->width); // display_horizontal_size
+ put_bits(&s->pb, 1, 1); // marker_bit
+ put_bits(&s->pb, 14, s->height); // display_vertical_size
+ put_bits(&s->pb, 3, 0); // remaining 3 bits are zero padding
}
put_header(s, GOP_START_CODE);
* fake MPEG frame rate in case of low frame rate */
fps = (framerate.num + framerate.den / 2) / framerate.den;
time_code = s->current_picture_ptr->f->coded_picture_number +
- s->avctx->timecode_frame_start;
+ s->timecode_frame_start;
s->gop_picture_number = s->current_picture_ptr->f->coded_picture_number;
if (s->drop_frame_timecode) {
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 6, (uint32_t)((time_code / fps) % 60));
put_bits(&s->pb, 6, (uint32_t)((time_code % fps)));
- put_bits(&s->pb, 1, !!(s->flags & CODEC_FLAG_CLOSED_GOP));
+ put_bits(&s->pb, 1, !!(s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) || s->intra_only);
put_bits(&s->pb, 1, 0); // broken link
}
}
static inline void encode_dc(MpegEncContext *s, int diff, int component)
{
- if (((unsigned) (diff + 255)) >= 511) {
+ unsigned int diff_u = diff + 255;
+ if (diff_u >= 511) {
int index;
if (diff < 0) {
}
static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
- int16_t block[6][64],
+ int16_t block[8][64],
int motion_x, int motion_y,
int mb_block_count)
{
}
}
-void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[6][64],
+void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[8][64],
int motion_x, int motion_y)
{
if (s->chroma_format == CHROMA_420)
int i;
done = 1;
- ff_init_rl(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]);
- ff_init_rl(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]);
+ ff_rl_init(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]);
+ ff_rl_init(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]);
for (i = 0; i < 64; i++) {
mpeg1_max_level[0][i] = ff_rl_mpeg1.max_level[0][i];
{ "drop_frame_timecode", "Timecode is in drop frame format.", \
OFFSET(drop_frame_timecode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, \
{ "scan_offset", "Reserve space for SVCD scan offset user data.", \
- OFFSET(scan_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+ OFFSET(scan_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, \
+ { "timecode_frame_start", "GOP timecode frame start number, in non-drop-frame format", \
+ OFFSET(timecode_frame_start), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, VE}, \
static const AVOption mpeg1_options[] = {
COMMON_OPTS
.id = AV_CODEC_ID_MPEG1VIDEO,
.priv_data_size = sizeof(MpegEncContext),
.init = encode_init,
- .encode2 = ff_MPV_encode_picture,
- .close = ff_MPV_encode_end,
+ .encode2 = ff_mpv_encode_picture,
+ .close = ff_mpv_encode_end,
.supported_framerates = ff_mpeg12_frame_rate_tab + 1,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
- .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
.priv_class = &mpeg1_class,
};
.id = AV_CODEC_ID_MPEG2VIDEO,
.priv_data_size = sizeof(MpegEncContext),
.init = encode_init,
- .encode2 = ff_MPV_encode_picture,
- .close = ff_MPV_encode_end,
+ .encode2 = ff_mpv_encode_picture,
+ .close = ff_mpv_encode_end,
.supported_framerates = ff_mpeg12_frame_rate_tab + 1,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV422P,
AV_PIX_FMT_NONE },
- .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
.priv_class = &mpeg2_class,
};