Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
23bfcc06
Commit
23bfcc06
authored
Feb 27, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegvideo_enc: add quantizer_noise_shaping private option.
Deprecate corresponding AVCodecContext field.
parent
16b7557b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
11 deletions
+17
-11
avcodec.h
libavcodec/avcodec.h
+4
-4
mpegvideo.h
libavcodec/mpegvideo.h
+3
-1
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+7
-5
options.c
libavcodec/options.c
+3
-1
No files found.
libavcodec/avcodec.h
View file @
23bfcc06
...
...
@@ -1757,12 +1757,12 @@ typedef struct AVCodecContext {
attribute_deprecated
int
inter_threshold
;
#endif
#if FF_API_MPV_GLOBAL_OPTS
/**
* quantizer noise shaping
* - encoding: Set by user.
* - decoding: unused
* @deprecated use mpegvideo private options instead
*/
int
quantizer_noise_shaping
;
attribute_deprecated
int
quantizer_noise_shaping
;
#endif
/**
* Motion estimation threshold below which no motion estimation is
...
...
libavcodec/mpegvideo.h
View file @
23bfcc06
...
...
@@ -691,6 +691,7 @@ typedef struct MpegEncContext {
void
(
*
denoise_dct
)(
struct
MpegEncContext
*
s
,
DCTELEM
*
block
);
int
mpv_flags
;
///< flags set by private options
int
quantizer_noise_shaping
;
}
MpegEncContext
;
#define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? \
...
...
@@ -715,7 +716,8 @@ typedef struct MpegEncContext {
{ "luma_elim_threshold", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)",\
FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
{ "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\
FF_MPV_OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },
FF_MPV_OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
{ "quantizer_noise_shaping", NULL, FF_MPV_OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, { 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS },
extern
const
AVOption
ff_mpv_generic_options
[];
...
...
libavcodec/mpegvideo_enc.c
View file @
23bfcc06
...
...
@@ -630,6 +630,8 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
s
->
mpv_flags
|=
FF_MPV_FLAG_SKIP_RD
;
if
(
avctx
->
flags2
&
CODEC_FLAG2_STRICT_GOP
)
s
->
mpv_flags
|=
FF_MPV_FLAG_STRICT_GOP
;
if
(
avctx
->
quantizer_noise_shaping
)
s
->
quantizer_noise_shaping
=
avctx
->
quantizer_noise_shaping
;
#endif
switch
(
avctx
->
codec
->
id
)
{
...
...
@@ -1949,7 +1951,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
}
}
if
(
s
->
avctx
->
quantizer_noise_shaping
)
{
if
(
s
->
quantizer_noise_shaping
)
{
if
(
!
skip_dct
[
0
])
get_visual_weight
(
weight
[
0
],
ptr_y
,
wrap_y
);
if
(
!
skip_dct
[
1
])
...
...
@@ -1990,7 +1992,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
}
else
s
->
block_last_index
[
i
]
=
-
1
;
}
if
(
s
->
avctx
->
quantizer_noise_shaping
)
{
if
(
s
->
quantizer_noise_shaping
)
{
for
(
i
=
0
;
i
<
mb_block_count
;
i
++
)
{
if
(
!
skip_dct
[
i
])
{
s
->
block_last_index
[
i
]
=
...
...
@@ -3738,7 +3740,7 @@ STOP_TIMER("init rem[]")
#ifdef REFINE_STATS
{
START_TIMER
#endif
analyze_gradient
=
last_non_zero
>
2
||
s
->
avctx
->
quantizer_noise_shaping
>=
3
;
analyze_gradient
=
last_non_zero
>
2
||
s
->
quantizer_noise_shaping
>=
3
;
if
(
analyze_gradient
){
#ifdef REFINE_STATS
...
...
@@ -3796,7 +3798,7 @@ STOP_TIMER("dct")}
const
int
level
=
block
[
j
];
int
change
,
old_coeff
;
if
(
s
->
avctx
->
quantizer_noise_shaping
<
3
&&
i
>
last_non_zero
+
1
)
if
(
s
->
quantizer_noise_shaping
<
3
&&
i
>
last_non_zero
+
1
)
break
;
if
(
level
){
...
...
@@ -3814,7 +3816,7 @@ STOP_TIMER("dct")}
int
score
,
new_coeff
,
unquant_change
;
score
=
0
;
if
(
s
->
avctx
->
quantizer_noise_shaping
<
2
&&
FFABS
(
new_level
)
>
FFABS
(
level
))
if
(
s
->
quantizer_noise_shaping
<
2
&&
FFABS
(
new_level
)
>
FFABS
(
level
))
continue
;
if
(
new_level
){
...
...
libavcodec/options.c
View file @
23bfcc06
...
...
@@ -325,7 +325,9 @@ static const AVOption options[]={
#endif
{
"flags2"
,
NULL
,
OFFSET
(
flags2
),
AV_OPT_TYPE_FLAGS
,
{.
dbl
=
DEFAULT
},
0
,
UINT_MAX
,
V
|
A
|
E
|
D
,
"flags2"
},
{
"error"
,
NULL
,
OFFSET
(
error_rate
),
AV_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"qns"
,
"quantizer noise shaping"
,
OFFSET
(
quantizer_noise_shaping
),
AV_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
#if FF_API_MPV_GLOBAL_OPTS
{
"qns"
,
"deprecated, use mpegvideo private options instead"
,
OFFSET
(
quantizer_noise_shaping
),
AV_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
#endif
{
"threads"
,
NULL
,
OFFSET
(
thread_count
),
AV_OPT_TYPE_INT
,
{.
dbl
=
1
},
0
,
INT_MAX
,
V
|
E
|
D
,
"threads"
},
{
"auto"
,
"detect a good number of threads"
,
0
,
AV_OPT_TYPE_CONST
,
{.
dbl
=
0
},
INT_MIN
,
INT_MAX
,
V
|
E
|
D
,
"threads"
},
{
"me_threshold"
,
"motion estimaton threshold"
,
OFFSET
(
me_threshold
),
AV_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment