Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
d6eb3c50
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d6eb3c50
编写于
8月 22, 2003
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
custom quant matrix encoding support
Originally committed as revision 2135 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
c3bf0288
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
50 addition
and
10 deletion
+50
-10
libavcodec/avcodec.h
libavcodec/avcodec.h
+16
-2
libavcodec/h263.c
libavcodec/h263.c
+14
-6
libavcodec/mpeg12.c
libavcodec/mpeg12.c
+3
-2
libavcodec/mpegvideo.c
libavcodec/mpegvideo.c
+16
-0
libavcodec/mpegvideo.h
libavcodec/mpegvideo.h
+1
-0
未找到文件。
libavcodec/avcodec.h
浏览文件 @
d6eb3c50
...
...
@@ -15,8 +15,8 @@ extern "C" {
#define LIBAVCODEC_VERSION_INT 0x000406
#define LIBAVCODEC_VERSION "0.4.6"
#define LIBAVCODEC_BUILD 467
4
#define LIBAVCODEC_BUILD_STR "467
4
"
#define LIBAVCODEC_BUILD 467
5
#define LIBAVCODEC_BUILD_STR "467
5
"
#define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" LIBAVCODEC_BUILD_STR
...
...
@@ -1186,6 +1186,20 @@ typedef struct AVCodecContext {
#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
#define FF_MB_DECISION_RD 2 ///< rate distoration
/**
* custom intra quantization matrix
* - encoding: set by user, can be NULL
* - decoding: set by lavc
*/
uint16_t
*
intra_matrix
;
/**
* custom inter quantization matrix
* - encoding: set by user, can be NULL
* - decoding: set by lavc
*/
uint16_t
*
inter_matrix
;
}
AVCodecContext
;
...
...
libavcodec/h263.c
浏览文件 @
d6eb3c50
...
...
@@ -1859,7 +1859,11 @@ static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_n
s
->
quant_precision
=
5
;
put_bits
(
&
s
->
pb
,
1
,
0
);
/* not 8 bit == false */
put_bits
(
&
s
->
pb
,
1
,
s
->
mpeg_quant
);
/* quant type= (0=h263 style)*/
if
(
s
->
mpeg_quant
)
put_bits
(
&
s
->
pb
,
2
,
0
);
/* no custom matrixes */
if
(
s
->
mpeg_quant
){
ff_write_quant_matrix
(
&
s
->
pb
,
s
->
avctx
->
intra_matrix
);
ff_write_quant_matrix
(
&
s
->
pb
,
s
->
avctx
->
inter_matrix
);
}
if
(
vo_ver_id
!=
1
)
put_bits
(
&
s
->
pb
,
1
,
s
->
quarter_sample
);
...
...
@@ -4551,14 +4555,15 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
skip_bits
(
gb
,
4
);
//video_object_layer_shape_extension
}
skip_bits1
(
gb
);
/* marker */
check_marker
(
gb
,
"before time_increment_resolution"
);
s
->
time_increment_resolution
=
get_bits
(
gb
,
16
);
s
->
time_increment_bits
=
av_log2
(
s
->
time_increment_resolution
-
1
)
+
1
;
if
(
s
->
time_increment_bits
<
1
)
s
->
time_increment_bits
=
1
;
skip_bits1
(
gb
);
/* marker */
check_marker
(
gb
,
"before fixed_vop_rate"
);
if
(
get_bits1
(
gb
)
!=
0
)
{
/* fixed_vop_rate */
skip_bits
(
gb
,
s
->
time_increment_bits
);
...
...
@@ -4648,8 +4653,8 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
/* replicate last value */
for
(;
i
<
64
;
i
++
){
int
j
=
s
->
dsp
.
idct_permutation
[
ff_zigzag_direct
[
i
]
];
s
->
intra_matrix
[
j
]
=
v
;
s
->
chroma_intra_matrix
[
j
]
=
v
;
s
->
intra_matrix
[
j
]
=
last
;
s
->
chroma_intra_matrix
[
j
]
=
last
;
}
}
...
...
@@ -4842,7 +4847,10 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
printf
(
"my guess is %d bits ;)
\n
"
,
s
->
time_increment_bits
);
}
time_increment
=
get_bits
(
gb
,
s
->
time_increment_bits
);
if
(
IS_3IV1
)
time_increment
=
get_bits1
(
gb
);
//FIXME investigate further
else
time_increment
=
get_bits
(
gb
,
s
->
time_increment_bits
);
// printf("%d %X\n", s->time_increment_bits, time_increment);
//printf(" type:%d modulo_time_base:%d increment:%d\n", s->pict_type, time_incr, time_increment);
if
(
s
->
pict_type
!=
B_TYPE
){
s
->
last_time_base
=
s
->
time_base
;
...
...
libavcodec/mpeg12.c
浏览文件 @
d6eb3c50
...
...
@@ -240,8 +240,9 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
vbv_buffer_size
=
((
20
*
s
->
bit_rate
)
/
(
1151929
/
2
))
*
8
*
1024
;
put_bits
(
&
s
->
pb
,
10
,
(
vbv_buffer_size
+
16383
)
/
16384
);
put_bits
(
&
s
->
pb
,
1
,
1
);
/* constrained parameter flag */
put_bits
(
&
s
->
pb
,
1
,
0
);
/* no custom intra matrix */
put_bits
(
&
s
->
pb
,
1
,
0
);
/* no custom non intra matrix */
ff_write_quant_matrix
(
&
s
->
pb
,
s
->
avctx
->
intra_matrix
);
ff_write_quant_matrix
(
&
s
->
pb
,
s
->
avctx
->
inter_matrix
);
put_header
(
s
,
GOP_START_CODE
);
put_bits
(
&
s
->
pb
,
1
,
0
);
/* do drop frame */
...
...
libavcodec/mpegvideo.c
浏览文件 @
d6eb3c50
...
...
@@ -167,6 +167,18 @@ void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_s
}
}
void
ff_write_quant_matrix
(
PutBitContext
*
pb
,
int16_t
*
matrix
){
int
i
;
if
(
matrix
){
put_bits
(
pb
,
1
,
1
);
for
(
i
=
0
;
i
<
64
;
i
++
)
{
put_bits
(
pb
,
8
,
matrix
[
ff_zigzag_direct
[
i
]
]);
}
}
else
put_bits
(
pb
,
1
,
0
);
}
/* init common dct for both encoder and decoder */
int
DCT_common_init
(
MpegEncContext
*
s
)
{
...
...
@@ -812,6 +824,10 @@ int MPV_encode_init(AVCodecContext *avctx)
s
->
intra_matrix
[
j
]
=
ff_mpeg1_default_intra_matrix
[
i
];
s
->
inter_matrix
[
j
]
=
ff_mpeg1_default_non_intra_matrix
[
i
];
}
if
(
s
->
avctx
->
intra_matrix
)
s
->
intra_matrix
[
j
]
=
s
->
avctx
->
intra_matrix
[
i
];
if
(
s
->
avctx
->
inter_matrix
)
s
->
inter_matrix
[
j
]
=
s
->
avctx
->
inter_matrix
[
i
];
}
/* precompute matrix */
...
...
libavcodec/mpegvideo.h
浏览文件 @
d6eb3c50
...
...
@@ -716,6 +716,7 @@ void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize, int block_w,
int
ff_combine_frame
(
MpegEncContext
*
s
,
int
next
,
uint8_t
**
buf
,
int
*
buf_size
);
void
ff_mpeg_flush
(
AVCodecContext
*
avctx
);
void
ff_print_debug_info
(
MpegEncContext
*
s
,
Picture
*
pict
);
void
ff_write_quant_matrix
(
PutBitContext
*
pb
,
int16_t
*
matrix
);
void
ff_er_frame_start
(
MpegEncContext
*
s
);
void
ff_er_frame_end
(
MpegEncContext
*
s
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录