aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2016-06-13 21:41:53 +0200
committerClément Bœsch <u@pkh.me>2016-06-14 08:23:23 +0200
commitfef89aae98a0f34c6da1ef88b51d32f21f87df08 (patch)
treec6506669ebd72d29e4382aa0ea96eb6e392c0187
parentcab237953ea60963c627df53833513a0764ff8fe (diff)
downloadffmpeg-fef89aae98a0f34c6da1ef88b51d32f21f87df08.tar.gz
lavc/h264: move green meta logging out of the sei decoding
This will simplify the next Libav merge where SEI decoding doesn't have access to the debug level anymore.
-rw-r--r--libavcodec/h264.c30
-rw-r--r--libavcodec/h264_sei.c33
2 files changed, 30 insertions, 33 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 367f6bf282..46eaec2ab0 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -959,6 +959,34 @@ static int get_last_needed_nal(H264Context *h)
return nals_needed;
}
+static void debug_green_metadata(const GreenMetaData *gm, void *logctx)
+{
+ av_log(logctx, AV_LOG_DEBUG, "Green Metadata Info SEI message\n");
+ av_log(logctx, AV_LOG_DEBUG, " green_metadata_type: %d\n", gm->green_metadata_type);
+
+ if (gm->green_metadata_type == 0) {
+ av_log(logctx, AV_LOG_DEBUG, " green_metadata_period_type: %d\n", gm->period_type);
+
+ if (gm->period_type == 2)
+ av_log(logctx, AV_LOG_DEBUG, " green_metadata_num_seconds: %d\n", gm->num_seconds);
+ else if (gm->period_type == 3)
+ av_log(logctx, AV_LOG_DEBUG, " green_metadata_num_pictures: %d\n", gm->num_pictures);
+
+ av_log(logctx, AV_LOG_DEBUG, " SEI GREEN Complexity Metrics: %f %f %f %f\n",
+ (float)gm->percent_non_zero_macroblocks/255,
+ (float)gm->percent_intra_coded_macroblocks/255,
+ (float)gm->percent_six_tap_filtering/255,
+ (float)gm->percent_alpha_point_deblocking_instance/255);
+
+ } else if (gm->green_metadata_type == 1) {
+ av_log(logctx, AV_LOG_DEBUG, " xsd_metric_type: %d\n", gm->xsd_metric_type);
+
+ if (gm->xsd_metric_type == 0)
+ av_log(logctx, AV_LOG_DEBUG, " xsd_metric_value: %f\n",
+ (float)gm->xsd_metric_value/100);
+ }
+}
+
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
int parse_extradata)
{
@@ -1141,6 +1169,8 @@ again:
case NAL_SEI:
h->gb = nal->gb;
ret = ff_h264_decode_sei(h);
+ if (avctx->debug & FF_DEBUG_GREEN_MD)
+ debug_green_metadata(&h->sei_green_metadata, h->avctx);
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
goto end;
break;
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 3c6d988d7f..b23878c8c5 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -365,33 +365,16 @@ static int decode_display_orientation(H264Context *h)
static int decode_GreenMetadata(H264Context *h)
{
- if (h->avctx->debug & FF_DEBUG_GREEN_MD)
- av_log(h->avctx, AV_LOG_DEBUG, "Green Metadata Info SEI message\n");
-
h->sei_green_metadata.green_metadata_type=get_bits(&h->gb, 8);
- if (h->avctx->debug & FF_DEBUG_GREEN_MD)
- av_log(h->avctx, AV_LOG_DEBUG, "green_metadata_type = %d\n",
- h->sei_green_metadata.green_metadata_type);
-
if (h->sei_green_metadata.green_metadata_type==0){
h->sei_green_metadata.period_type=get_bits(&h->gb, 8);
- if (h->avctx->debug & FF_DEBUG_GREEN_MD)
- av_log(h->avctx, AV_LOG_DEBUG, "green_metadata_period_type = %d\n",
- h->sei_green_metadata.period_type);
-
if (h->sei_green_metadata.period_type==2){
h->sei_green_metadata.num_seconds = get_bits(&h->gb, 16);
- if (h->avctx->debug & FF_DEBUG_GREEN_MD)
- av_log(h->avctx, AV_LOG_DEBUG, "green_metadata_num_seconds = %d\n",
- h->sei_green_metadata.num_seconds);
}
else if (h->sei_green_metadata.period_type==3){
h->sei_green_metadata.num_pictures = get_bits(&h->gb, 16);
- if (h->avctx->debug & FF_DEBUG_GREEN_MD)
- av_log(h->avctx, AV_LOG_DEBUG, "green_metadata_num_pictures = %d\n",
- h->sei_green_metadata.num_pictures);
}
h->sei_green_metadata.percent_non_zero_macroblocks=get_bits(&h->gb, 8);
@@ -399,25 +382,9 @@ static int decode_GreenMetadata(H264Context *h)
h->sei_green_metadata.percent_six_tap_filtering=get_bits(&h->gb, 8);
h->sei_green_metadata.percent_alpha_point_deblocking_instance=get_bits(&h->gb, 8);
- if (h->avctx->debug & FF_DEBUG_GREEN_MD)
- av_log(h->avctx, AV_LOG_DEBUG, "SEI GREEN Complexity Metrics = %f %f %f %f\n",
- (float)h->sei_green_metadata.percent_non_zero_macroblocks/255,
- (float)h->sei_green_metadata.percent_intra_coded_macroblocks/255,
- (float)h->sei_green_metadata.percent_six_tap_filtering/255,
- (float)h->sei_green_metadata.percent_alpha_point_deblocking_instance/255);
-
}else if( h->sei_green_metadata.green_metadata_type==1){
h->sei_green_metadata.xsd_metric_type=get_bits(&h->gb, 8);
h->sei_green_metadata.xsd_metric_value=get_bits(&h->gb, 16);
-
- if (h->avctx->debug & FF_DEBUG_GREEN_MD)
- av_log(h->avctx, AV_LOG_DEBUG, "xsd_metric_type = %d\n",
- h->sei_green_metadata.xsd_metric_type);
- if ( h->sei_green_metadata.xsd_metric_type==0){
- if (h->avctx->debug & FF_DEBUG_GREEN_MD)
- av_log(h->avctx, AV_LOG_DEBUG, "xsd_metric_value = %f\n",
- (float)h->sei_green_metadata.xsd_metric_value/100);
- }
}
return 0;