Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
3e7b04af
Commit
3e7b04af
authored
Sep 12, 2014
by
Minghai Shang
Committed by
Gerrit Code Review
Sep 12, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge "[spatial svc] Output psnr for all layers in one packet."
parents
7f77a1c3
e3fff31a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
34 deletions
+50
-34
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_encoder.c
+4
-1
vp9/encoder/vp9_svc_layercontext.h
vp9/encoder/vp9_svc_layercontext.h
+1
-0
vp9/vp9_cx_iface.c
vp9/vp9_cx_iface.c
+11
-6
vpx/src/svc_encodeframe.c
vpx/src/svc_encodeframe.c
+31
-26
vpx/src/vpx_encoder.c
vpx/src/vpx_encoder.c
+1
-1
vpx/vpx_encoder.h
vpx/vpx_encoder.h
+2
-0
No files found.
vp9/encoder/vp9_encoder.c
View file @
3e7b04af
...
...
@@ -1280,7 +1280,10 @@ static void generate_psnr_packet(VP9_COMP *cpi) {
pkt
.
data
.
psnr
.
psnr
[
i
]
=
psnr
.
psnr
[
i
];
}
pkt
.
kind
=
VPX_CODEC_PSNR_PKT
;
vpx_codec_pkt_list_add
(
cpi
->
output_pkt_list
,
&
pkt
);
if
(
is_two_pass_svc
(
cpi
))
cpi
->
svc
.
layer_context
[
cpi
->
svc
.
spatial_layer_id
].
psnr_pkt
=
pkt
.
data
.
psnr
;
else
vpx_codec_pkt_list_add
(
cpi
->
output_pkt_list
,
&
pkt
);
}
int
vp9_use_as_reference
(
VP9_COMP
*
cpi
,
int
ref_frame_flags
)
{
...
...
vp9/encoder/vp9_svc_layercontext.h
View file @
3e7b04af
...
...
@@ -36,6 +36,7 @@ typedef struct {
int
gold_ref_idx
;
int
has_alt_frame
;
size_t
layer_size
;
struct
vpx_psnr_pkt
psnr_pkt
;
}
LAYER_CONTEXT
;
typedef
struct
{
...
...
vp9/vp9_cx_iface.c
View file @
3e7b04af
...
...
@@ -985,15 +985,20 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx,
cx_data_sz
-=
size
;
#if CONFIG_SPATIAL_SVC
if
(
is_two_pass_svc
(
cpi
))
{
vpx_codec_cx_pkt_t
pkt
;
vpx_codec_cx_pkt_t
pkt
_sizes
,
pkt_psnr
;
int
i
;
vp9_zero
(
pkt
);
pkt
.
kind
=
VPX_CODEC_SPATIAL_SVC_LAYER_SIZES
;
vp9_zero
(
pkt_sizes
);
vp9_zero
(
pkt_psnr
);
pkt_sizes
.
kind
=
VPX_CODEC_SPATIAL_SVC_LAYER_SIZES
;
pkt_psnr
.
kind
=
VPX_CODEC_SPATIAL_SVC_LAYER_PSNR
;
for
(
i
=
0
;
i
<
cpi
->
svc
.
number_spatial_layers
;
++
i
)
{
pkt
.
data
.
layer_sizes
[
i
]
=
cpi
->
svc
.
layer_context
[
i
].
layer_size
;
cpi
->
svc
.
layer_context
[
i
].
layer_size
=
0
;
LAYER_CONTEXT
*
lc
=
&
cpi
->
svc
.
layer_context
[
i
];
pkt_sizes
.
data
.
layer_sizes
[
i
]
=
lc
->
layer_size
;
pkt_psnr
.
data
.
layer_psnr
[
i
]
=
lc
->
psnr_pkt
;
lc
->
layer_size
=
0
;
}
vpx_codec_pkt_list_add
(
&
ctx
->
pkt_list
.
head
,
&
pkt
);
vpx_codec_pkt_list_add
(
&
ctx
->
pkt_list
.
head
,
&
pkt_sizes
);
vpx_codec_pkt_list_add
(
&
ctx
->
pkt_list
.
head
,
&
pkt_psnr
);
}
#endif
}
...
...
vpx/src/svc_encodeframe.c
View file @
3e7b04af
...
...
@@ -107,7 +107,7 @@ typedef struct SvcInternal {
// state variables
int
encode_frame_count
;
int
frame
_received
;
int
psnr_pkt
_received
;
int
frame_within_gop
;
int
layers
;
int
layer
;
...
...
@@ -566,7 +566,6 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
vpx_codec_err_t
res
;
vpx_codec_iter_t
iter
;
const
vpx_codec_cx_pkt_t
*
cx_pkt
;
int
layer_for_psnr
=
0
;
SvcInternal
*
const
si
=
get_svc_internal
(
svc_ctx
);
if
(
svc_ctx
==
NULL
||
codec_ctx
==
NULL
||
si
==
NULL
)
{
return
VPX_CODEC_INVALID_PARAM
;
...
...
@@ -603,30 +602,37 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
iter
=
NULL
;
while
((
cx_pkt
=
vpx_codec_get_cx_data
(
codec_ctx
,
&
iter
)))
{
switch
(
cx_pkt
->
kind
)
{
case
VPX_CODEC_PSNR_PKT
:
{
#if CONFIG_SPATIAL_SVC
case
VPX_CODEC_SPATIAL_SVC_LAYER_PSNR
:
{
int
i
;
svc_log
(
svc_ctx
,
SVC_LOG_DEBUG
,
"SVC frame: %d, layer: %d, PSNR(Total/Y/U/V): "
"%2.3f %2.3f %2.3f %2.3f
\n
"
,
si
->
frame_received
,
layer_for_psnr
,
cx_pkt
->
data
.
psnr
.
psnr
[
0
],
cx_pkt
->
data
.
psnr
.
psnr
[
1
],
cx_pkt
->
data
.
psnr
.
psnr
[
2
],
cx_pkt
->
data
.
psnr
.
psnr
[
3
]);
svc_log
(
svc_ctx
,
SVC_LOG_DEBUG
,
"SVC frame: %d, layer: %d, SSE(Total/Y/U/V): "
"%2.3f %2.3f %2.3f %2.3f
\n
"
,
si
->
frame_received
,
layer_for_psnr
,
cx_pkt
->
data
.
psnr
.
sse
[
0
],
cx_pkt
->
data
.
psnr
.
sse
[
1
],
cx_pkt
->
data
.
psnr
.
sse
[
2
],
cx_pkt
->
data
.
psnr
.
sse
[
3
]);
for
(
i
=
0
;
i
<
COMPONENTS
;
i
++
)
{
si
->
psnr_sum
[
layer_for_psnr
][
i
]
+=
cx_pkt
->
data
.
psnr
.
psnr
[
i
];
si
->
sse_sum
[
layer_for_psnr
][
i
]
+=
cx_pkt
->
data
.
psnr
.
sse
[
i
];
for
(
i
=
0
;
i
<
svc_ctx
->
spatial_layers
;
++
i
)
{
int
j
;
svc_log
(
svc_ctx
,
SVC_LOG_DEBUG
,
"SVC frame: %d, layer: %d, PSNR(Total/Y/U/V): "
"%2.3f %2.3f %2.3f %2.3f
\n
"
,
si
->
psnr_pkt_received
,
i
,
cx_pkt
->
data
.
layer_psnr
[
i
].
psnr
[
0
],
cx_pkt
->
data
.
layer_psnr
[
i
].
psnr
[
1
],
cx_pkt
->
data
.
layer_psnr
[
i
].
psnr
[
2
],
cx_pkt
->
data
.
layer_psnr
[
i
].
psnr
[
3
]);
svc_log
(
svc_ctx
,
SVC_LOG_DEBUG
,
"SVC frame: %d, layer: %d, SSE(Total/Y/U/V): "
"%2.3f %2.3f %2.3f %2.3f
\n
"
,
si
->
psnr_pkt_received
,
i
,
cx_pkt
->
data
.
layer_psnr
[
i
].
sse
[
0
],
cx_pkt
->
data
.
layer_psnr
[
i
].
sse
[
1
],
cx_pkt
->
data
.
layer_psnr
[
i
].
sse
[
2
],
cx_pkt
->
data
.
layer_psnr
[
i
].
sse
[
3
]);
for
(
j
=
0
;
j
<
COMPONENTS
;
++
j
)
{
si
->
psnr_sum
[
i
][
j
]
+=
cx_pkt
->
data
.
layer_psnr
[
i
].
psnr
[
j
];
si
->
sse_sum
[
i
][
j
]
+=
cx_pkt
->
data
.
layer_psnr
[
i
].
sse
[
j
];
}
}
++
layer_for_psnr
;
if
(
layer_for_psnr
==
svc_ctx
->
spatial_layers
)
layer_for_psnr
=
0
;
++
si
->
psnr_pkt_received
;
break
;
}
#if CONFIG_SPATIAL_SVC
case
VPX_CODEC_SPATIAL_SVC_LAYER_SIZES
:
{
int
i
;
for
(
i
=
0
;
i
<
si
->
layers
;
++
i
)
...
...
@@ -673,7 +679,7 @@ static double calc_psnr(double d) {
// dump accumulated statistics and reset accumulated values
const
char
*
vpx_svc_dump_statistics
(
SvcContext
*
svc_ctx
)
{
int
number_of_frames
,
encode_frame_count
;
int
number_of_frames
;
int
i
,
j
;
uint32_t
bytes_total
=
0
;
double
scale
[
COMPONENTS
];
...
...
@@ -686,12 +692,11 @@ const char *vpx_svc_dump_statistics(SvcContext *svc_ctx) {
svc_log_reset
(
svc_ctx
);
encode_frame_count
=
si
->
encode_frame_count
;
if
(
si
->
encode_frame_count
<=
0
)
return
vpx_svc_get_message
(
svc_ctx
);
number_of_frames
=
si
->
psnr_pkt_received
;
if
(
number_of_frames
<=
0
)
return
vpx_svc_get_message
(
svc_ctx
);
svc_log
(
svc_ctx
,
SVC_LOG_INFO
,
"
\n
"
);
for
(
i
=
0
;
i
<
si
->
layers
;
++
i
)
{
number_of_frames
=
encode_frame_count
;
svc_log
(
svc_ctx
,
SVC_LOG_INFO
,
"Layer %d Average PSNR=[%2.3f, %2.3f, %2.3f, %2.3f], Bytes=[%u]
\n
"
,
...
...
vpx/src/vpx_encoder.c
View file @
3e7b04af
...
...
@@ -15,8 +15,8 @@
*/
#include <limits.h>
#include <string.h>
#include "vpx/internal/vpx_codec_internal.h"
#include "vpx_config.h"
#include "vpx/internal/vpx_codec_internal.h"
#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
...
...
vpx/vpx_encoder.h
View file @
3e7b04af
...
...
@@ -163,6 +163,7 @@ extern "C" {
VPX_CODEC_PSNR_PKT
,
/**< PSNR statistics for this frame */
#if CONFIG_SPATIAL_SVC
VPX_CODEC_SPATIAL_SVC_LAYER_SIZES
,
/**< Sizes for each layer in this frame*/
VPX_CODEC_SPATIAL_SVC_LAYER_PSNR
,
/**< PSNR for each layer in this frame*/
#endif
VPX_CODEC_CUSTOM_PKT
=
256
/**< Algorithm extensions */
};
...
...
@@ -202,6 +203,7 @@ extern "C" {
vpx_fixed_buf_t
raw
;
/**< data for arbitrary packets */
#if CONFIG_SPATIAL_SVC
size_t
layer_sizes
[
VPX_SS_MAX_LAYERS
];
struct
vpx_psnr_pkt
layer_psnr
[
VPX_SS_MAX_LAYERS
];
#endif
/* This packet size is fixed to allow codecs to extend this
...
...
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