Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astrataro/0b52ad970de6bde573cb to your computer and use it in GitHub Desktop.
Save astrataro/0b52ad970de6bde573cb to your computer and use it in GitHub Desktop.
Skip bit depth filter when possible for high bit depth y4m
From 7f59423ad3ea1edece92a21816f653862a43a98a Mon Sep 17 00:00:00 2001
From: Lucien <astrataro@gmail.com>
Date: Sat, 20 Oct 2012 15:22:35 +0100
Subject: [PATCH] Skip bit depth filter when possible for high bit depth y4m
For high bit depth y4m:
https://github.com/DarkShikari/x264-devel/commit/a7530d18bef4a32c79e60094e4f6195ef333057f
Should be appended after:
https://github.com/astrataro/x264_tMod/commit/9b01c879dc51f249a9019d9e381ce0bc10a75e93
Useless if raw bit depth conversion moved into input.c:
https://github.com/jeeb/x264-devel/commit/b2147f7d1f7e6f530d2461462b4f26038d1dd614
---
input/y4m.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/input/y4m.c b/input/y4m.c
index e60b27a..dba05a2 100644
--- a/input/y4m.c
+++ b/input/y4m.c
@@ -198,7 +198,14 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
h->frame_size = h->frame_header_len;
if( h->bit_depth > 8 )
+ {
info->csp |= X264_CSP_HIGH_DEPTH;
+ if( h->bit_depth == BIT_DEPTH )
+ {
+ /* HACK: totally skips depth filter to prevent dither error */
+ info->csp |= X264_CSP_SKIP_DEPTH_FILTER;
+ }
+ }
const x264_cli_csp_t *csp = x264_cli_get_csp( info->csp );
@@ -250,7 +257,7 @@ static int read_frame_internal( cli_pic_t *pic, y4m_hnd_t *h )
for( i = 0; i < pic->img.planes && !error; i++ )
{
error |= fread( pic->img.plane[i], pixel_depth, h->plane_size[i], h->fh ) != h->plane_size[i];
- if( h->bit_depth & 7 )
+ if( h->bit_depth & 7 && h->bit_depth != BIT_DEPTH )
{
/* upconvert non 16bit high depth planes to 16bit using the same
* algorithm as used in the depth filter. */
--
1.7.11.msysgit.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment