Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
3edcacde
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,发现更多精彩内容 >>
提交
3edcacde
编写于
3月 16, 2004
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init cleanup
Originally committed as revision 2899 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
6fe1a1a5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
76 addition
and
59 deletion
+76
-59
libavcodec/h263dec.c
libavcodec/h263dec.c
+1
-1
libavcodec/h264.c
libavcodec/h264.c
+2
-1
libavcodec/mjpeg.c
libavcodec/mjpeg.c
+3
-5
libavcodec/mpeg12.c
libavcodec/mpeg12.c
+3
-0
libavcodec/mpegvideo.c
libavcodec/mpegvideo.c
+62
-50
libavcodec/mpegvideo.h
libavcodec/mpegvideo.h
+1
-0
libavcodec/rv10.c
libavcodec/rv10.c
+2
-2
libavcodec/svq1.c
libavcodec/svq1.c
+2
-0
未找到文件。
libavcodec/h263dec.c
浏览文件 @
3edcacde
...
...
@@ -42,8 +42,8 @@ int ff_h263_decode_init(AVCodecContext *avctx)
s
->
workaround_bugs
=
avctx
->
workaround_bugs
;
// set defaults
MPV_decode_defaults
(
s
);
s
->
quant_precision
=
5
;
s
->
progressive_sequence
=
1
;
s
->
decode_mb
=
ff_h263_decode_mb
;
s
->
low_delay
=
1
;
avctx
->
pix_fmt
=
PIX_FMT_YUV420P
;
...
...
libavcodec/h264.c
浏览文件 @
3edcacde
...
...
@@ -2166,6 +2166,8 @@ static int decode_init(AVCodecContext *avctx){
H264Context
*
h
=
avctx
->
priv_data
;
MpegEncContext
*
const
s
=
&
h
->
s
;
MPV_decode_defaults
(
s
);
s
->
avctx
=
avctx
;
common_init
(
h
);
...
...
@@ -2173,7 +2175,6 @@ static int decode_init(AVCodecContext *avctx){
s
->
workaround_bugs
=
avctx
->
workaround_bugs
;
// set defaults
s
->
progressive_sequence
=
1
;
// s->decode_mb= ff_h263_decode_mb;
s
->
low_delay
=
1
;
avctx
->
pix_fmt
=
PIX_FMT_YUV420P
;
...
...
libavcodec/mjpeg.c
浏览文件 @
3edcacde
...
...
@@ -862,13 +862,11 @@ static int mjpeg_decode_init(AVCodecContext *avctx)
memset
(
&
s2
,
0
,
sizeof
(
MpegEncContext
));
s2
.
avctx
=
avctx
;
// s2->out_format = FMT_MJPEG;
s2
.
width
=
8
;
s2
.
height
=
8
;
if
(
MPV_common_init
(
&
s2
)
<
0
)
return
-
1
;
dsputil_init
(
&
s2
.
dsp
,
avctx
);
DCT_common_init
(
&
s2
);
s
->
scantable
=
s2
.
intra_scantable
;
s
->
idct_put
=
s2
.
dsp
.
idct_put
;
MPV_common_end
(
&
s2
);
s
->
mpeg_enc_ctx_allocated
=
0
;
s
->
buffer_size
=
102400
;
/* smaller buffer should be enough,
...
...
libavcodec/mpeg12.c
浏览文件 @
3edcacde
...
...
@@ -1760,6 +1760,9 @@ typedef struct Mpeg1Context {
static
int
mpeg_decode_init
(
AVCodecContext
*
avctx
)
{
Mpeg1Context
*
s
=
avctx
->
priv_data
;
MpegEncContext
*
s2
=
&
s
->
mpeg_enc_ctx
;
MPV_decode_defaults
(
s2
);
s
->
mpeg_enc_ctx
.
avctx
=
avctx
;
s
->
mpeg_enc_ctx
.
flags
=
avctx
->
flags
;
...
...
libavcodec/mpegvideo.c
浏览文件 @
3edcacde
...
...
@@ -502,7 +502,62 @@ static void update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContex
#undef COPY
}
/* init common structure for both encoder and decoder */
/**
* sets the given MpegEncContext to common defaults (same for encoding and decoding).
* the changed fields will not depend upon the prior state of the MpegEncContext.
*/
static
void
MPV_common_defaults
(
MpegEncContext
*
s
){
s
->
y_dc_scale_table
=
s
->
c_dc_scale_table
=
ff_mpeg1_dc_scale_table
;
s
->
chroma_qscale_table
=
ff_default_chroma_qscale_table
;
s
->
progressive_frame
=
1
;
s
->
progressive_sequence
=
1
;
s
->
picture_structure
=
PICT_FRAME
;
s
->
coded_picture_number
=
0
;
s
->
picture_number
=
0
;
s
->
input_picture_number
=
0
;
s
->
picture_in_gop_number
=
0
;
}
/**
* sets the given MpegEncContext to defaults for decoding.
* the changed fields will not depend upon the prior state of the MpegEncContext.
*/
void
MPV_decode_defaults
(
MpegEncContext
*
s
){
MPV_common_defaults
(
s
);
}
/**
* sets the given MpegEncContext to defaults for encoding.
* the changed fields will not depend upon the prior state of the MpegEncContext.
*/
void
MPV_encode_defaults
(
MpegEncContext
*
s
){
static
int
done
=
0
;
MPV_common_defaults
(
s
);
if
(
!
done
){
int
i
;
done
=
1
;
default_mv_penalty
=
av_mallocz
(
sizeof
(
uint8_t
)
*
(
MAX_FCODE
+
1
)
*
(
2
*
MAX_MV
+
1
)
);
memset
(
default_mv_penalty
,
0
,
sizeof
(
uint8_t
)
*
(
MAX_FCODE
+
1
)
*
(
2
*
MAX_MV
+
1
));
memset
(
default_fcode_tab
,
0
,
sizeof
(
uint8_t
)
*
(
2
*
MAX_MV
+
1
));
for
(
i
=-
16
;
i
<
16
;
i
++
){
default_fcode_tab
[
i
+
MAX_MV
]
=
1
;
}
}
s
->
me
.
mv_penalty
=
default_mv_penalty
;
s
->
fcode_tab
=
default_fcode_tab
;
}
/**
* init common structure for both encoder and decoder.
* this assumes that some variables like width/height are already set
*/
int
MPV_common_init
(
MpegEncContext
*
s
)
{
int
y_size
,
c_size
,
yc_size
,
i
,
mb_array_size
,
mv_table_size
,
x
,
y
;
...
...
@@ -533,28 +588,11 @@ int MPV_common_init(MpegEncContext *s)
s
->
block_wrap
[
3
]
=
s
->
mb_width
*
2
+
2
;
s
->
block_wrap
[
4
]
=
s
->
block_wrap
[
5
]
=
s
->
mb_width
+
2
;
s
->
y_dc_scale_table
=
s
->
c_dc_scale_table
=
ff_mpeg1_dc_scale_table
;
s
->
chroma_qscale_table
=
ff_default_chroma_qscale_table
;
if
(
s
->
codec_id
!=
CODEC_ID_MPEG1VIDEO
&&
s
->
codec_id
!=
CODEC_ID_MPEG2VIDEO
)
{
/* default structure is frame */
s
->
progressive_frame
=
1
;
s
->
picture_structure
=
PICT_FRAME
;
s
->
y_dc_scale_table
=
s
->
c_dc_scale_table
=
ff_mpeg1_dc_scale_table
;
if
(
!
s
->
encoding
)
s
->
progressive_sequence
=
1
;
}
s
->
coded_picture_number
=
0
;
y_size
=
(
2
*
s
->
mb_width
+
2
)
*
(
2
*
s
->
mb_height
+
2
);
c_size
=
(
s
->
mb_width
+
2
)
*
(
s
->
mb_height
+
2
);
yc_size
=
y_size
+
2
*
c_size
;
/* convert fourcc to upper case */
s
->
avctx
->
codec_tag
=
toupper
(
s
->
avctx
->
codec_tag
&
0xFF
)
+
(
toupper
((
s
->
avctx
->
codec_tag
>>
8
)
&
0xFF
)
<<
8
)
...
...
@@ -663,9 +701,6 @@ int MPV_common_init(MpegEncContext *s)
CHECKED_ALLOCZ
(
s
->
mbintra_table
,
mb_array_size
);
memset
(
s
->
mbintra_table
,
1
,
mb_array_size
);
/* default structure is frame */
s
->
picture_structure
=
PICT_FRAME
;
/* init macroblock skip table */
CHECKED_ALLOCZ
(
s
->
mbskip_table
,
mb_array_size
+
2
);
//Note the +1 is for a quicker mpeg4 slice_end detection
...
...
@@ -787,6 +822,8 @@ int MPV_encode_init(AVCodecContext *avctx)
MpegEncContext
*
s
=
avctx
->
priv_data
;
int
i
,
dummy
;
int
chroma_h_shift
,
chroma_v_shift
;
MPV_encode_defaults
(
s
);
avctx
->
pix_fmt
=
PIX_FMT_YUV420P
;
// FIXME
...
...
@@ -1070,28 +1107,6 @@ int MPV_encode_init(AVCodecContext *avctx)
return
-
1
;
}
{
/* set up some save defaults, some codecs might override them later */
static
int
done
=
0
;
if
(
!
done
){
int
i
;
done
=
1
;
default_mv_penalty
=
av_mallocz
(
sizeof
(
uint8_t
)
*
(
MAX_FCODE
+
1
)
*
(
2
*
MAX_MV
+
1
)
);
memset
(
default_mv_penalty
,
0
,
sizeof
(
uint8_t
)
*
(
MAX_FCODE
+
1
)
*
(
2
*
MAX_MV
+
1
));
memset
(
default_fcode_tab
,
0
,
sizeof
(
uint8_t
)
*
(
2
*
MAX_MV
+
1
));
for
(
i
=-
16
;
i
<
16
;
i
++
){
default_fcode_tab
[
i
+
MAX_MV
]
=
1
;
}
}
}
s
->
me
.
mv_penalty
=
default_mv_penalty
;
s
->
fcode_tab
=
default_fcode_tab
;
/* dont use mv_penalty table for crap MV as it would be confused */
//FIXME remove after fixing / removing old ME
if
(
s
->
me_method
<
ME_EPZS
)
s
->
me
.
mv_penalty
=
default_mv_penalty
;
s
->
encoding
=
1
;
/* init */
...
...
@@ -1119,7 +1134,7 @@ int MPV_encode_init(AVCodecContext *avctx)
ff_mpeg1_encode_init
(
s
);
#endif
/* init
default
q matrix */
/* init q matrix */
for
(
i
=
0
;
i
<
64
;
i
++
)
{
int
j
=
s
->
dsp
.
idct_permutation
[
i
];
#ifdef CONFIG_RISKY
...
...
@@ -1153,13 +1168,10 @@ int MPV_encode_init(AVCodecContext *avctx)
if
(
ff_rate_control_init
(
s
)
<
0
)
return
-
1
;
s
->
picture_number
=
0
;
s
->
input_picture_number
=
0
;
s
->
picture_in_gop_number
=
0
;
/* motion detector init */
s
->
f_code
=
1
;
s
->
b_code
=
1
;
return
0
;
}
...
...
libavcodec/mpegvideo.h
浏览文件 @
3edcacde
...
...
@@ -706,6 +706,7 @@ typedef struct MpegEncContext {
int
DCT_common_init
(
MpegEncContext
*
s
);
void
MPV_decode_defaults
(
MpegEncContext
*
s
);
int
MPV_common_init
(
MpegEncContext
*
s
);
void
MPV_common_end
(
MpegEncContext
*
s
);
void
MPV_decode_mb
(
MpegEncContext
*
s
,
DCTELEM
block
[
6
][
64
]);
...
...
libavcodec/rv10.c
浏览文件 @
3edcacde
...
...
@@ -441,6 +441,8 @@ static int rv10_decode_init(AVCodecContext *avctx)
MpegEncContext
*
s
=
avctx
->
priv_data
;
static
int
done
=
0
;
MPV_decode_defaults
(
s
);
s
->
avctx
=
avctx
;
s
->
out_format
=
FMT_H263
;
s
->
codec_id
=
avctx
->
codec_id
;
...
...
@@ -490,8 +492,6 @@ static int rv10_decode_init(AVCodecContext *avctx)
h263_decode_init_vlc
(
s
);
s
->
progressive_sequence
=
1
;
/* init rv vlc */
if
(
!
done
)
{
init_vlc
(
&
rv_dc_lum
,
DC_VLC_BITS
,
256
,
...
...
libavcodec/svq1.c
浏览文件 @
3edcacde
...
...
@@ -783,6 +783,8 @@ static int svq1_decode_init(AVCodecContext *avctx)
MpegEncContext
*
s
=
avctx
->
priv_data
;
int
i
;
MPV_decode_defaults
(
s
);
s
->
avctx
=
avctx
;
s
->
width
=
(
avctx
->
width
+
3
)
&~
3
;
s
->
height
=
(
avctx
->
height
+
3
)
&~
3
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录