# HG changeset patch # User alex # Date 1062425081 0 # Node ID 1590742cf1c48ee3416df5d59dc9381e1442398d # Parent c554ca1115de5b361003cb44109f72a92fd97ab1 support for user specified intra/inter matrices diff -r c554ca1115de -r 1590742cf1c4 libmpcodecs/ve_lavc.c --- a/libmpcodecs/ve_lavc.c Mon Sep 01 13:26:05 2003 +0000 +++ b/libmpcodecs/ve_lavc.c Mon Sep 01 14:04:41 2003 +0000 @@ -127,6 +127,8 @@ #endif static int lavc_param_coder= 0; static int lavc_param_context= 0; +static char *lavc_param_intra_matrix = NULL; +static char *lavc_param_inter_matrix = NULL; #include "m_option.h" @@ -218,6 +220,10 @@ {"coder", &lavc_param_coder, CONF_TYPE_INT, CONF_RANGE, 0, 10, NULL}, {"context", &lavc_param_context, CONF_TYPE_INT, CONF_RANGE, 0, 10, NULL}, #endif +#if LIBAVCODEC_BUILD >= 4675 + {"intra_matrix", &lavc_param_intra_matrix, CONF_TYPE_STRING, 0, 0, 0, NULL}, + {"inter_matrix", &lavc_param_inter_matrix, CONF_TYPE_STRING, 0, 0, 0, NULL}, +#endif {NULL, NULL, 0, 0, 0, 0, NULL} }; #endif @@ -320,6 +326,54 @@ lavc_venc_context->coder_type= lavc_param_coder; lavc_venc_context->context_model= lavc_param_context; #endif +#if LIBAVCODEC_BUILD >= 4675 + if (lavc_param_intra_matrix) + { + char *tmp; + + lavc_venc_context->intra_matrix = + malloc(sizeof(*lavc_venc_context->intra_matrix)*64); + + i = 0; + while ((tmp = strsep(&lavc_param_intra_matrix, ",")) && (i < 64)) + { + if (!tmp || (tmp && !strlen(tmp))) + break; + lavc_venc_context->intra_matrix[i++] = atoi(tmp); + } + + if (i != 64) + { + free(lavc_venc_context->intra_matrix); + lavc_venc_context->intra_matrix = NULL; + } + else + mp_msg(MSGT_MENCODER, MSGL_V, "Using user specified intra matrix\n"); + } + if (lavc_param_inter_matrix) + { + char *tmp; + + lavc_venc_context->inter_matrix = + malloc(sizeof(*lavc_venc_context->inter_matrix)*64); + + i = 0; + while ((tmp = strsep(&lavc_param_inter_matrix, ",")) && (i < 64)) + { + if (!tmp || (tmp && !strlen(tmp))) + break; + lavc_venc_context->inter_matrix[i++] = atoi(tmp); + } + + if (i != 64) + { + free(lavc_venc_context->inter_matrix); + lavc_venc_context->inter_matrix = NULL; + } + else + mp_msg(MSGT_MENCODER, MSGL_V, "Using user specified inter matrix\n"); + } +#endif p= lavc_param_rc_override_string; for(i=0; p; i++){ @@ -650,6 +704,15 @@ } #endif +#if LIBAVCODEC_BUILD >= 4675 + if (lavc_venc_context->intra_matrix) + free(lavc_venc_context->intra_matrix); + lavc_venc_context->intra_matrix = NULL; + if (lavc_venc_context->inter_matrix) + free(lavc_venc_context->inter_matrix); + lavc_venc_context->inter_matrix = NULL; +#endif + avcodec_close(lavc_venc_context); if(stats_file) fclose(stats_file);