mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
mpegvideo_enc: add cbp_rd flag to mpv_flags.
Deprecate CODEC_FLAG_CBP_RD.
This commit is contained in:
parent
ff71a383ac
commit
af3d804f9f
@ -561,7 +561,6 @@ typedef struct RcOverride{
|
||||
#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT).
|
||||
/* Fx : Flag for h263+ extra options */
|
||||
#define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
|
||||
#define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp.
|
||||
#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter
|
||||
#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation
|
||||
#define CODEC_FLAG_CLOSED_GOP 0x80000000
|
||||
@ -569,6 +568,7 @@ typedef struct RcOverride{
|
||||
#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding.
|
||||
#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata.
|
||||
#if FF_API_MPV_GLOBAL_OPTS
|
||||
#define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp.
|
||||
#define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon.
|
||||
#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size.
|
||||
#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping
|
||||
|
@ -148,7 +148,7 @@ static inline int get_p_cbp(MpegEncContext * s,
|
||||
int motion_x, int motion_y){
|
||||
int cbp, i;
|
||||
|
||||
if(s->flags & CODEC_FLAG_CBP_RD){
|
||||
if (s->mpv_flags & FF_MPV_FLAG_CBP_RD) {
|
||||
int best_cbpy_score= INT_MAX;
|
||||
int best_cbpc_score= INT_MAX;
|
||||
int cbpc = (-1), cbpy= (-1);
|
||||
|
@ -430,7 +430,7 @@ static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
|
||||
{
|
||||
int cbp = 0, i;
|
||||
|
||||
if (s->flags & CODEC_FLAG_CBP_RD) {
|
||||
if (s->mpv_flags & FF_MPV_FLAG_CBP_RD) {
|
||||
int score = 0;
|
||||
const int lambda = s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
|
||||
|
||||
|
@ -702,6 +702,7 @@ typedef struct MpegEncContext {
|
||||
#define FF_MPV_FLAG_SKIP_RD 0x0001
|
||||
#define FF_MPV_FLAG_STRICT_GOP 0x0002
|
||||
#define FF_MPV_FLAG_QP_RD 0x0004
|
||||
#define FF_MPV_FLAG_CBP_RD 0x0008
|
||||
|
||||
#define FF_MPV_OFFSET(x) offsetof(MpegEncContext, x)
|
||||
#define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
||||
@ -709,7 +710,8 @@ typedef struct MpegEncContext {
|
||||
{ "mpv_flags", "Flags common for all mpegvideo-based encoders.", FF_MPV_OFFSET(mpv_flags), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, "mpv_flags" },\
|
||||
{ "skip_rd", "RD optimal MB level residual skipping", 0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_SKIP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
|
||||
{ "strict_gop", "Strictly enforce gop size", 0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_STRICT_GOP }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
|
||||
{ "qp_rd", "Use rate distortion optimization for qp selection", 0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_QP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },
|
||||
{ "qp_rd", "Use rate distortion optimization for qp selection", 0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_QP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
|
||||
{ "cbp_rd", "use rate distortion optimization for CBP", 0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_CBP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },
|
||||
|
||||
extern const AVOption ff_mpv_generic_options[];
|
||||
|
||||
|
@ -495,7 +495,12 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis) {
|
||||
#if FF_API_MPV_GLOBAL_OPTS
|
||||
if (s->flags & CODEC_FLAG_CBP_RD)
|
||||
s->mpv_flags |= FF_MPV_FLAG_CBP_RD;
|
||||
#endif
|
||||
|
||||
if ((s->mpv_flags & FF_MPV_FLAG_CBP_RD) && !avctx->trellis) {
|
||||
av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n");
|
||||
return -1;
|
||||
}
|
||||
@ -1998,7 +2003,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
|
||||
for (i = 4; i < mb_block_count; i++)
|
||||
dct_single_coeff_elimination(s, i, s->chroma_elim_threshold);
|
||||
|
||||
if (s->flags & CODEC_FLAG_CBP_RD) {
|
||||
if (s->mpv_flags & FF_MPV_FLAG_CBP_RD) {
|
||||
for (i = 0; i < mb_block_count; i++) {
|
||||
if (s->block_last_index[i] == -1)
|
||||
s->coded_score[i] = INT_MAX / 256;
|
||||
|
@ -97,8 +97,8 @@ static const AVOption options[]={
|
||||
{"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"},
|
||||
{"bitexact", "use only bitexact stuff (except (i)dct)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_BITEXACT }, INT_MIN, INT_MAX, A|V|S|D|E, "flags"},
|
||||
{"aic", "h263 advanced intra coding / mpeg4 ac prediction", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_AC_PRED }, INT_MIN, INT_MAX, V|E, "flags"},
|
||||
{"cbp", "use rate distortion optimization for cbp", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_CBP_RD }, INT_MIN, INT_MAX, V|E, "flags"},
|
||||
#if FF_API_MPV_GLOBAL_OPTS
|
||||
{"cbp", "Deprecated, use mpegvideo private options instead", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_CBP_RD }, INT_MIN, INT_MAX, V|E, "flags"},
|
||||
{"qprd", "Deprecated, use mpegvideo private options instead", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_QP_RD }, INT_MIN, INT_MAX, V|E, "flags"},
|
||||
#endif
|
||||
{"ilme", "interlaced motion estimation", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, "flags"},
|
||||
|
Loading…
Reference in New Issue
Block a user