Mercurial > mplayer.hg
changeset 10779:1590742cf1c4
support for user specified intra/inter matrices
author | alex |
---|---|
date | Mon, 01 Sep 2003 14:04:41 +0000 |
parents | c554ca1115de |
children | 94dd8a952b40 |
files | libmpcodecs/ve_lavc.c |
diffstat | 1 files changed, 63 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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);