Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
libvpx
Commits
14dbdd95
Commit
14dbdd95
authored
Dec 06, 2017
by
Jerome Jiang
Committed by
Gerrit Code Review
Dec 06, 2017
Browse files
Merge "Add frame width & height to frame pkt. Add test."
parents
3562d6b0
bd1d995c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
1 deletion
+47
-1
test/resize_test.cc
test/resize_test.cc
+40
-0
vp8/vp8_cx_iface.c
vp8/vp8_cx_iface.c
+2
-0
vp9/vp9_cx_iface.c
vp9/vp9_cx_iface.c
+2
-0
vpx/vpx_encoder.h
vpx/vpx_encoder.h
+3
-1
No files found.
test/resize_test.cc
View file @
14dbdd95
...
...
@@ -277,12 +277,29 @@ class ResizeTest
SetMode
(
GET_PARAM
(
1
));
}
virtual
void
FramePktHook
(
const
vpx_codec_cx_pkt_t
*
pkt
)
{
ASSERT_NE
(
static_cast
<
int
>
(
pkt
->
data
.
frame
.
width
),
0
);
ASSERT_NE
(
static_cast
<
int
>
(
pkt
->
data
.
frame
.
height
),
0
);
encode_frame_width_
.
push_back
(
pkt
->
data
.
frame
.
width
);
encode_frame_height_
.
push_back
(
pkt
->
data
.
frame
.
height
);
}
unsigned
int
GetFrameWidth
(
size_t
idx
)
const
{
return
encode_frame_width_
[
idx
];
}
unsigned
int
GetFrameHeight
(
size_t
idx
)
const
{
return
encode_frame_height_
[
idx
];
}
virtual
void
DecompressedFrameHook
(
const
vpx_image_t
&
img
,
vpx_codec_pts_t
pts
)
{
frame_info_list_
.
push_back
(
FrameInfo
(
pts
,
img
.
d_w
,
img
.
d_h
));
}
std
::
vector
<
FrameInfo
>
frame_info_list_
;
std
::
vector
<
unsigned
int
>
encode_frame_width_
;
std
::
vector
<
unsigned
int
>
encode_frame_height_
;
};
TEST_P
(
ResizeTest
,
TestExternalResizeWorks
)
{
...
...
@@ -296,6 +313,9 @@ TEST_P(ResizeTest, TestExternalResizeWorks) {
const
unsigned
int
frame
=
static_cast
<
unsigned
>
(
info
->
pts
);
unsigned
int
expected_w
;
unsigned
int
expected_h
;
const
size_t
idx
=
info
-
frame_info_list_
.
begin
();
ASSERT_EQ
(
info
->
w
,
GetFrameWidth
(
idx
));
ASSERT_EQ
(
info
->
h
,
GetFrameHeight
(
idx
));
ScaleForFrameNumber
(
frame
,
kInitialWidth
,
kInitialHeight
,
&
expected_w
,
&
expected_h
,
0
);
EXPECT_EQ
(
expected_w
,
info
->
w
)
...
...
@@ -464,8 +484,23 @@ class ResizeRealtimeTest
++
mismatch_nframes_
;
}
virtual
void
FramePktHook
(
const
vpx_codec_cx_pkt_t
*
pkt
)
{
ASSERT_NE
(
static_cast
<
int
>
(
pkt
->
data
.
frame
.
width
),
0
);
ASSERT_NE
(
static_cast
<
int
>
(
pkt
->
data
.
frame
.
height
),
0
);
encode_frame_width_
.
push_back
(
pkt
->
data
.
frame
.
width
);
encode_frame_height_
.
push_back
(
pkt
->
data
.
frame
.
height
);
}
unsigned
int
GetMismatchFrames
()
{
return
mismatch_nframes_
;
}
unsigned
int
GetFrameWidth
(
size_t
idx
)
const
{
return
encode_frame_width_
[
idx
];
}
unsigned
int
GetFrameHeight
(
size_t
idx
)
const
{
return
encode_frame_height_
[
idx
];
}
void
DefaultConfig
()
{
cfg_
.
rc_buf_initial_sz
=
500
;
cfg_
.
rc_buf_optimal_sz
=
600
;
...
...
@@ -493,6 +528,8 @@ class ResizeRealtimeTest
bool
change_bitrate_
;
double
mismatch_psnr_
;
int
mismatch_nframes_
;
std
::
vector
<
unsigned
int
>
encode_frame_width_
;
std
::
vector
<
unsigned
int
>
encode_frame_height_
;
};
TEST_P
(
ResizeRealtimeTest
,
TestExternalResizeWorks
)
{
...
...
@@ -582,6 +619,9 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
int
resize_count
=
0
;
for
(
std
::
vector
<
FrameInfo
>::
const_iterator
info
=
frame_info_list_
.
begin
();
info
!=
frame_info_list_
.
end
();
++
info
)
{
const
size_t
idx
=
info
-
frame_info_list_
.
begin
();
ASSERT_EQ
(
info
->
w
,
GetFrameWidth
(
idx
));
ASSERT_EQ
(
info
->
h
,
GetFrameHeight
(
idx
));
if
(
info
->
w
!=
last_w
||
info
->
h
!=
last_h
)
{
resize_count
++
;
if
(
resize_count
==
1
)
{
...
...
vp8/vp8_cx_iface.c
View file @
14dbdd95
...
...
@@ -902,6 +902,8 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx,
(
unsigned
long
)((
delta
*
ctx
->
cfg
.
g_timebase
.
den
+
round
)
/
ctx
->
cfg
.
g_timebase
.
num
/
10000000
);
pkt
.
data
.
frame
.
flags
=
lib_flags
<<
16
;
pkt
.
data
.
frame
.
width
=
cpi
->
common
.
Width
;
pkt
.
data
.
frame
.
height
=
cpi
->
common
.
Height
;
if
(
lib_flags
&
FRAMEFLAGS_KEY
)
{
pkt
.
data
.
frame
.
flags
|=
VPX_FRAME_IS_KEY
;
...
...
vp9/vp9_cx_iface.c
View file @
14dbdd95
...
...
@@ -1260,6 +1260,8 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx,
pkt
.
data
.
frame
.
duration
=
(
unsigned
long
)
ticks_to_timebase_units
(
timebase
,
dst_end_time_stamp
-
dst_time_stamp
);
pkt
.
data
.
frame
.
flags
=
get_frame_pkt_flags
(
cpi
,
lib_flags
);
pkt
.
data
.
frame
.
width
=
cpi
->
common
.
width
;
pkt
.
data
.
frame
.
height
=
cpi
->
common
.
height
;
if
(
ctx
->
pending_cx_data
)
{
ctx
->
pending_frame_sizes
[
ctx
->
pending_frame_count
++
]
=
size
;
...
...
vpx/vpx_encoder.h
View file @
14dbdd95
...
...
@@ -63,7 +63,7 @@ extern "C" {
* fields to structures
*/
#define VPX_ENCODER_ABI_VERSION \
(
6
+ VPX_CODEC_ABI_VERSION)
/**<\hideinitializer*/
(
7
+ VPX_CODEC_ABI_VERSION)
/**<\hideinitializer*/
/*! \brief Encoder capabilities bitfield
*
...
...
@@ -182,6 +182,8 @@ typedef struct vpx_codec_cx_pkt {
* Only applicable when "output partition" mode is enabled. First
* partition has id 0.*/
int
partition_id
;
unsigned
int
width
;
/**< frame width */
unsigned
int
height
;
/**< frame height */
}
frame
;
/**< data for compressed frame packet */
vpx_fixed_buf_t
twopass_stats
;
/**< data for two-pass packet */
vpx_fixed_buf_t
firstpass_mb_stats
;
/**< first pass mb packet */
...
...
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