Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
85eca52b
Commit
85eca52b
authored
Jan 31, 2009
by
Roman Shaposhnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplifying DIF encoding process
Originally committed as revision 16877 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
76bd5997
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
22 deletions
+24
-22
dv.c
libavcodec/dv.c
+24
-22
No files found.
libavcodec/dv.c
View file @
85eca52b
...
@@ -1001,7 +1001,6 @@ static int dv_encode_video_segment(AVCodecContext *avctx, DVwork_chunk *work_chu
...
@@ -1001,7 +1001,6 @@ static int dv_encode_video_segment(AVCodecContext *avctx, DVwork_chunk *work_chu
int
mb_x
,
mb_y
,
c_offset
,
linesize
;
int
mb_x
,
mb_y
,
c_offset
,
linesize
;
uint8_t
*
y_ptr
;
uint8_t
*
y_ptr
;
uint8_t
*
data
;
uint8_t
*
data
;
uint8_t
*
ptr
;
uint8_t
*
dif
;
uint8_t
*
dif
;
uint8_t
scratch
[
64
];
uint8_t
scratch
[
64
];
EncBlockInfo
enc_blks
[
5
*
DV_MAX_BPM
];
EncBlockInfo
enc_blks
[
5
*
DV_MAX_BPM
];
...
@@ -1010,17 +1009,16 @@ static int dv_encode_video_segment(AVCodecContext *avctx, DVwork_chunk *work_chu
...
@@ -1010,17 +1009,16 @@ static int dv_encode_video_segment(AVCodecContext *avctx, DVwork_chunk *work_chu
EncBlockInfo
*
enc_blk
;
EncBlockInfo
*
enc_blk
;
int
vs_bit_size
=
0
;
int
vs_bit_size
=
0
;
int
qnos
[
5
];
int
qnos
[
5
];
int
*
qnosp
=
&
qnos
[
0
];
dif
=
&
s
->
buf
[
work_chunk
->
buf_offset
*
80
];
dif
=
&
s
->
buf
[
work_chunk
->
buf_offset
*
80
];
enc_blk
=
&
enc_blks
[
0
];
enc_blk
=
&
enc_blks
[
0
];
pb
=
&
pbs
[
0
];
for
(
mb_index
=
0
;
mb_index
<
5
;
mb_index
++
)
{
for
(
mb_index
=
0
;
mb_index
<
5
;
mb_index
++
)
{
dv_calculate_mb_xy
(
s
,
work_chunk
,
mb_index
,
&
mb_x
,
&
mb_y
);
dv_calculate_mb_xy
(
s
,
work_chunk
,
mb_index
,
&
mb_x
,
&
mb_y
);
y_ptr
=
s
->
picture
.
data
[
0
]
+
((
mb_y
*
s
->
picture
.
linesize
[
0
]
+
mb_x
)
<<
3
);
y_ptr
=
s
->
picture
.
data
[
0
]
+
((
mb_y
*
s
->
picture
.
linesize
[
0
]
+
mb_x
)
<<
3
);
c_offset
=
(((
mb_y
>>
(
s
->
sys
->
pix_fmt
==
PIX_FMT_YUV420P
))
*
s
->
picture
.
linesize
[
1
]
+
c_offset
=
(((
mb_y
>>
(
s
->
sys
->
pix_fmt
==
PIX_FMT_YUV420P
))
*
s
->
picture
.
linesize
[
1
]
+
(
mb_x
>>
((
s
->
sys
->
pix_fmt
==
PIX_FMT_YUV411P
)
?
2
:
1
)))
<<
3
);
(
mb_x
>>
((
s
->
sys
->
pix_fmt
==
PIX_FMT_YUV411P
)
?
2
:
1
)))
<<
3
);
qnos
[
mb_index
]
=
15
;
/* No quantization */
qnos
[
mb_index
]
=
15
;
/* No quantization */
ptr
=
dif
+
mb_index
*
80
+
4
;
for
(
j
=
0
;
j
<
6
;
j
++
)
{
for
(
j
=
0
;
j
<
6
;
j
++
)
{
if
(
s
->
sys
->
pix_fmt
==
PIX_FMT_YUV422P
)
{
/* 4:2:2 */
if
(
s
->
sys
->
pix_fmt
==
PIX_FMT_YUV422P
)
{
/* 4:2:2 */
if
(
j
==
0
||
j
==
2
)
{
if
(
j
==
0
||
j
==
2
)
{
...
@@ -1067,34 +1065,38 @@ static int dv_encode_video_segment(AVCodecContext *avctx, DVwork_chunk *work_chu
...
@@ -1067,34 +1065,38 @@ static int dv_encode_video_segment(AVCodecContext *avctx, DVwork_chunk *work_chu
vs_bit_size
+=
dv_init_enc_block
(
enc_blk
,
data
,
linesize
,
s
,
j
>>
2
);
vs_bit_size
+=
dv_init_enc_block
(
enc_blk
,
data
,
linesize
,
s
,
j
>>
2
);
init_put_bits
(
pb
,
ptr
,
s
->
sys
->
block_sizes
[
j
]
/
8
);
put_bits
(
pb
,
9
,
(
uint16_t
)(((
enc_blk
->
mb
[
0
]
>>
3
)
-
1024
+
2
)
>>
2
));
put_bits
(
pb
,
1
,
enc_blk
->
dct_mode
);
put_bits
(
pb
,
2
,
enc_blk
->
cno
);
++
enc_blk
;
++
enc_blk
;
++
pb
;
ptr
+=
s
->
sys
->
block_sizes
[
j
]
/
8
;
}
}
}
}
if
(
vs_total_ac_bits
<
vs_bit_size
)
if
(
vs_total_ac_bits
<
vs_bit_size
)
dv_guess_qnos
(
&
enc_blks
[
0
],
&
qnos
[
0
]
);
dv_guess_qnos
(
&
enc_blks
[
0
],
qnosp
);
for
(
i
=
0
;
i
<
5
;
i
++
)
{
/* DIF encoding process */
dif
[
i
*
80
+
3
]
=
qnos
[
i
];
for
(
j
=
0
;
j
<
5
*
s
->
sys
->
bpm
;)
{
}
int
start_mb
=
j
;
dif
[
3
]
=
*
qnosp
++
;
dif
+=
4
;
/* First pass over individual cells only */
/* First pass over individual cells only */
for
(
j
=
0
;
j
<
5
*
s
->
sys
->
bpm
;
j
++
)
for
(
i
=
0
;
i
<
s
->
sys
->
bpm
;
i
++
,
j
++
)
{
dv_encode_ac
(
&
enc_blks
[
j
],
&
pbs
[
j
],
&
pbs
[
j
+
1
]);
int
sz
=
s
->
sys
->
block_sizes
[
i
]
>>
3
;
init_put_bits
(
&
pbs
[
j
],
dif
,
sz
);
put_bits
(
&
pbs
[
j
],
9
,
(
uint16_t
)(((
enc_blks
[
j
].
mb
[
0
]
>>
3
)
-
1024
+
2
)
>>
2
));
put_bits
(
&
pbs
[
j
],
1
,
enc_blks
[
j
].
dct_mode
);
put_bits
(
&
pbs
[
j
],
2
,
enc_blks
[
j
].
cno
);
dv_encode_ac
(
&
enc_blks
[
j
],
&
pbs
[
j
],
&
pbs
[
j
+
1
]);
dif
+=
sz
;
}
/* Second pass over each MB space */
/* Second pass over each MB space */
for
(
j
=
0
;
j
<
5
*
s
->
sys
->
bpm
;
j
+=
s
->
sys
->
bpm
)
{
pb
=
&
pbs
[
start_mb
];
pb
=
&
pbs
[
j
];
for
(
i
=
0
;
i
<
s
->
sys
->
bpm
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
sys
->
bpm
;
i
++
)
{
if
(
enc_blks
[
i
+
j
].
partial_bit_count
)
if
(
enc_blks
[
start_mb
+
i
].
partial_bit_count
)
pb
=
dv_encode_ac
(
&
enc_blks
[
i
+
j
],
pb
,
&
pbs
[
j
+
s
->
sys
->
bpm
]);
pb
=
dv_encode_ac
(
&
enc_blks
[
start_mb
+
i
],
pb
,
&
pbs
[
start_mb
+
s
->
sys
->
bpm
]);
}
}
}
}
...
...
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