avfilter/vf_lut: do not always explicitly clip pixels

Old behaviour was not useful at all. New behaviour only emulate
old behaviour with default options.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2017-02-13 21:52:51 +01:00
parent fb32c561c3
commit 72864547f9
2 changed files with 42 additions and 42 deletions

View File

@ -84,17 +84,17 @@ typedef struct LutContext {
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static const AVOption options[] = {
{ "c0", "set component #0 expression", OFFSET(comp_expr_str[0]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "c1", "set component #1 expression", OFFSET(comp_expr_str[1]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "c2", "set component #2 expression", OFFSET(comp_expr_str[2]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "c3", "set component #3 expression", OFFSET(comp_expr_str[3]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "y", "set Y expression", OFFSET(comp_expr_str[Y]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "u", "set U expression", OFFSET(comp_expr_str[U]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "v", "set V expression", OFFSET(comp_expr_str[V]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "r", "set R expression", OFFSET(comp_expr_str[R]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "g", "set G expression", OFFSET(comp_expr_str[G]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "b", "set B expression", OFFSET(comp_expr_str[B]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "a", "set A expression", OFFSET(comp_expr_str[A]), AV_OPT_TYPE_STRING, { .str = "val" }, .flags = FLAGS },
{ "c0", "set component #0 expression", OFFSET(comp_expr_str[0]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ "c1", "set component #1 expression", OFFSET(comp_expr_str[1]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ "c2", "set component #2 expression", OFFSET(comp_expr_str[2]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ "c3", "set component #3 expression", OFFSET(comp_expr_str[3]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ "y", "set Y expression", OFFSET(comp_expr_str[Y]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ "u", "set U expression", OFFSET(comp_expr_str[U]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ "v", "set V expression", OFFSET(comp_expr_str[V]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ "r", "set R expression", OFFSET(comp_expr_str[R]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ "g", "set G expression", OFFSET(comp_expr_str[G]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ "b", "set B expression", OFFSET(comp_expr_str[B]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ "a", "set A expression", OFFSET(comp_expr_str[A]), AV_OPT_TYPE_STRING, { .str = "clipval" }, .flags = FLAGS },
{ NULL }
};
@ -265,7 +265,7 @@ static int config_props(AVFilterLink *inlink)
max[Y] = 235 * (1 << (desc->comp[0].depth - 8));
max[U] = 240 * (1 << (desc->comp[1].depth - 8));
max[V] = 240 * (1 << (desc->comp[2].depth - 8));
max[A] = (1 << desc->comp[3].depth) - 1;
max[A] = (1 << desc->comp[0].depth) - 1;
break;
case AV_PIX_FMT_RGB48LE:
case AV_PIX_FMT_RGBA64LE:
@ -324,7 +324,7 @@ static int config_props(AVFilterLink *inlink)
s->comp_expr_str[color], val, comp);
return AVERROR(EINVAL);
}
s->lut[comp][val] = av_clip((int)res, min[color], max[color]);
s->lut[comp][val] = av_clip((int)res, 0, max[A]);
av_log(ctx, AV_LOG_DEBUG, "val[%d][%d] = %d\n", comp, val, s->lut[comp][val]);
}
}

View File

@ -15,35 +15,35 @@ rgb24 a356171207723a580e7d277078072005
rgb48le 5c7dd8575836d18c91e09f1915cf9aa9
rgba 7bc854c2698b78af3e9159a19c2d9d21
rgba64le 3a087ecab583d1930220592731f282b4
yuv410p 51b39a0e33f108e652457a26667319ea
yuv411p 9204c5af92aef4922a05f58c1f6c095e
yuv420p 7c43bb0cae8dee633375c89295598508
yuv420p10le 1352712dd31cce78bd5441294004cf85
yuv420p12le c66f82da9fda458ba3abda057c58e591
yuv420p14le e45cb5e2a75bf6143da0b55004767f78
yuv420p16le eff54782c51770edfd6b84c958ac7120
yuv420p9le 4a6776b3379f12ad45caee8072a13695
yuv422p 67df35da0c35e54882492b2365438254
yuv422p10le 0158371a800294015def7f0ef66c78ea
yuv422p12le bc49d3863ffb89658a17bf8c4fe773b0
yuv422p14le b55cb791d286b0b3391fe7481785e5b3
yuv422p16le fc3b2ba889ffaf1633000fc774307c33
yuv422p9le 6e2a42ae36ed5e8b5112987639728af5
yuv440p 5e41adcfc27be4369afd217b61b2ffe3
yuv440p10le 8b49714bba268fb4a79b5a84223ad17a
yuv440p12le 15ab4f453238bd9c13b18af81e22f060
yuv444p a2b58590aef88db2c1f14a1a3a3b0359
yuv444p10le c076c20fc808f95b34adb88aca442f48
yuv444p12le af8d4dd88169d5cffc2f3fce6333a94c
yuv444p14le 93367133e25d088d4535199ed1f1ed58
yuv444p16le 800940feec14365ccd9b4863e38f6991
yuv444p9le c120044350852c4cd16a302dd1ceda79
yuva420p 518a380bf1af60ef2ecf4754eec088e9
yuva420p16le 72ad4fa535b007d122666ce103ef9c8b
yuva422p 7110ac2e37377b05b6fc5ad967dfabb5
yuva422p16le e2867210660ada5784a60b4339ac52c0
yuva444p 642f3958f141dece9e99407945e2ef43
yuva444p16le ab04ba8acbe38085b0df650d82065eb0
yuv410p 10cf5dbbccb858a9ab51e0b8bf278f6d
yuv411p 3f0bfa543ba513c6b6d7fff785fbe150
yuv420p ad99204ace669a383f8ae03a1ea5b98f
yuv420p10le f1e6cc4c2a5e9665dedd7ac0f2a4d551
yuv420p12le d9dfe871483b6a26512d427cb048ff65
yuv420p14le cd8bb4803f8e99c6cd31149bf848c30c
yuv420p16le 4bb13820cf2de9b40ca47adeb7fea356
yuv420p9le f12c98b599e667fc45126d6dea7f0fd9
yuv422p c57e304bb3f4a1d30bf4ced5e829cdc6
yuv422p10le 9d95b03f75ae5778804279f3c3135837
yuv422p12le 08e73e233793740ad68a939b9886dd32
yuv422p14le bea6b54ec3e33eadfbd317a175b96288
yuv422p16le 5438e5738ab3e1e5f7fce5faaac036c4
yuv422p9le 222a699b69ba8d511518a61d77a10c25
yuv440p f8105ff9433ecdedf2645f3370a575d8
yuv440p10le 6e104ac6c33b00185bb6d95b371e1354
yuv440p12le 636834efcba838d74337b2ebb9dbffb3
yuv444p ca662e7bd7a28805650f25b1537d50a2
yuv444p10le c301eb2763e0f74fde94388046c437fa
yuv444p12le 9482b13de4a9fbce176e8344c9332139
yuv444p14le fb558c97e59e884fe5ba407df158ebd5
yuv444p16le be9b3ce54168159b132746f7ac9088fe
yuv444p9le fa4b9bd6b8cac96e10322e613c8e7149
yuva420p 7284cbf9eacf1ca5ce9e2efebcadf999
yuva420p16le b37d34212c2a79e91b675bc87dac6cc6
yuva422p 5938a7c7588febb069bd0cd4c447305e
yuva422p16le c5ccfdc1a0dc6cb130c07ea61df6f727
yuva444p fbcbdc3521d17c702ee521b0893098e4
yuva444p16le b7142d28d4d069d7eb019dcaf8b323b1
yuvj420p 65bc88887c7f06a6221155ca7f9cfca4
yuvj422p ff5baffefc8ffe4547653092fd7da200
yuvj440p ef3f27270e60ac06582e3ac7c2f3e6fa