Projects
Essentials
x265
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 22
View file
x265.changes
Changed
@@ -1,4 +1,44 @@ ------------------------------------------------------------------- +Thu Apr 27 14:15:13 UTC 2017 - joerg.lorenzen@ki.tng.de + +- Update to version 2.4 + Encoder enhancements + * HDR10+ supported. Dynamic metadata may be either supplied as a + bitstream via the userSEI field of x265_picture, or as a json + jile that can be parsed by x265 and inserted into the bitstream; + use --dhdr10-info to specify json file name, and --dhdr10-opt + to enable optimization of inserting tone-map information only + at IDR frames, or when the tone map information changes. + * Lambda tables for 8, 10, and 12-bit encoding revised, resulting + in significant enhancement to subjective visual quality. + * Enhanced HDR10 encoding with HDR-specific QP optimzations for + chroma, and luma planes of WCG content enabled; use --hdr-opt + to activate. + * Ability to accept analysis information from other previous + encodes (that may or may not be x265), and selectively reuse + and refine analysis for encoding subsequent passes enabled with + the --refine-level option. + * Slow and veryslow presets receive a 20% speed boost at + iso-quality by enabling the --limit-tu option. + * The bitrate target for x265 can now be dynamically reconfigured + via the reconfigure API. + * Performance optimized SAO algorithm introduced via the + --limit-sao option; seeing 10% speed benefits at faster presets. + API changes + * x265_reconfigure API now also accepts rate-control parameters + for dynamic reconfiguration. + * Several additions to data fields in x265_analysis to support + --refine-level: see x265.h for more details. + Bug fixes + * Avoid negative offsets in x265 lambda2 table with SAO enabled. + * Fix mingw32 build error. + * Seek now enabled for pipe input, in addition to file-based input. + * Fix issue of statically linking core-utils not working in linux. + * Fix visual artifacts with --multi-pass-opt-distortion with VBV. + * Fix bufferFill stats reported in csv. +- soname bump to 116. + +------------------------------------------------------------------- Fri Feb 24 14:03:24 UTC 2017 - ismail@i10z.com - Update to version 2.3
View file
x265.spec
Changed
@@ -1,10 +1,10 @@ # based on the spec file from https://build.opensuse.org/package/view_file/home:Simmphonie/libx265/ Name: x265 -%define soname 110 +%define soname 116 %define libname lib%{name} %define libsoname %{libname}-%{soname} -Version: 2.3 +Version: 2.4 Release: 0 License: GPL-2.0+ Summary: A free h265/HEVC encoder - encoder binary
View file
baselibs.conf
Changed
@@ -1,1 +1,1 @@ -libx265-110 +libx265-116
View file
x265_2.3.tar.gz/.hg_archival.txt -> x265_2.4.tar.gz/.hg_archival.txt
Changed
@@ -1,4 +1,4 @@ repo: 09fe40627f03a0f9c3e6ac78b22ac93da23f9fdf -node: 3037c1448549ca920967831482c653e5892fa8ed +node: e7a4dd48293b7956d4a20df257d23904cc78e376 branch: stable -tag: 2.3 +tag: 2.4
View file
x265_2.3.tar.gz/.hgtags -> x265_2.4.tar.gz/.hgtags
Changed
@@ -21,3 +21,4 @@ 960c9991d0dcf46559c32e070418d3cbb7e8aa2f 2.0 981e3bfef16a997bce6f46ce1b15631a0e234747 2.1 be14a7e9755e54f0fd34911c72bdfa66981220bc 2.2 +3037c1448549ca920967831482c653e5892fa8ed 2.3
View file
x265_2.3.tar.gz/doc/reST/cli.rst -> x265_2.4.tar.gz/doc/reST/cli.rst
Changed
@@ -816,6 +816,25 @@ Specify a filename for analysis data (see :option:`--analysis-mode`) If no filename is specified, x265_analysis.dat is used. +.. option:: --refine-level <1..10> + + Amount of information stored/reused in :option:`--analysis-mode` is distributed across levels. + Higher the value, higher the information stored/reused, faster the encode. Default 5. + + Note that --refine-level must be paired with analysis-mode. + + +--------+-----------------------------------------+ + | Level | Description | + +========+=========================================+ + | 1 | Lookahead information | + +--------+-----------------------------------------+ + | 2 to 4 | Level 1 + intra/inter modes, ref's | + +--------+-----------------------------------------+ + | 5 to 9 | Level 2 + rect-amp | + +--------+-----------------------------------------+ + | 10 | Level 5 + Full CU analysis-info | + +--------+-----------------------------------------+ + Options which affect the transform unit quad-tree, sometimes referred to as the residual quad-tree (RQT). @@ -1671,9 +1690,15 @@ disabled, SAO analysis skips the right/bottom boundary areas. Default disabled +.. option:: --limit-sao, --no-limit-sao + + Limit SAO filter computation by early terminating SAO process based + on inter prediction mode, CTU spatial-domain correlations, and relations + between luma and chroma. + Default disabled + VUI (Video Usability Information) options ========================================= - x265 emits a VUI with only the timing info by default. If the SAR is specified (or read from a Y4M header) it is also included. All other VUI fields must be manually specified. @@ -1845,6 +1870,22 @@ automatically when :option`--master-display` or :option`--max-cll` is specified. Useful when there is a desire to signal 0 values for max-cll and max-fall. Default disabled. + +.. option:: --hdr-opt, --no-hdr-opt + + Add luma and chroma offsets for HDR/WCG content. + Input video should be 10 bit 4:2:0. Applicable for HDR content. + Default disabled. **Experimental Feature** + +.. option:: --dhdr10-info <filename> + + Inserts tone mapping information as an SEI message. + +.. option:: --dhdr10-opt, --no-dhdr10-opt + + Limits the frames for which tone mapping information is inserted as + SEI message. Inserts SEI only for IDR frames and for frames where tone + mapping information has changed. .. option:: --min-luma <integer>
View file
x265_2.3.tar.gz/doc/reST/presets.rst -> x265_2.4.tar.gz/doc/reST/presets.rst
Changed
@@ -95,6 +95,8 @@ +-----------------+-----+-----+-----+-----+-----+-----+------+------+------+------+ | tu-inter | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 3 | 4 | +-----------------+-----+-----+-----+-----+-----+-----+------+------+------+------+ +| limit-tu | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 | 0 | ++-----------------+-----+-----+-----+-----+-----+-----+------+------+------+------+ .. _tunings:
View file
x265_2.3.tar.gz/doc/reST/releasenotes.rst -> x265_2.4.tar.gz/doc/reST/releasenotes.rst
Changed
@@ -2,6 +2,38 @@ Release Notes ************* +Release Notes +************* + +Version 2.4 +=========== + +Release date - 22nd April, 2017. + +Encoder enhancements +-------------------- +1. HDR10+ supported. Dynamic metadata may be either supplied as a bitstream via the userSEI field of x265_picture, or as a json jile that can be parsed by x265 and inserted into the bitstream; use :option:`--dhdr10-info` to specify json file name, and :option:`--dhdr10-opt` to enable optimization of inserting tone-map information only at IDR frames, or when the tone map information changes. +2. Lambda tables for 8, 10, and 12-bit encoding revised, resulting in significant enhancement to subjective visual quality. +3. Enhanced HDR10 encoding with HDR-specific QP optimzations for chroma, and luma planes of WCG content enabled; use :option:`--hdr-opt` to activate. +4. Ability to accept analysis information from other previous encodes (that may or may not be x265), and selectively reuse and refine analysis for encoding subsequent passes enabled with the :option:`--refine-level` option. +5. Slow and veryslow presets receive a 20% speed boost at iso-quality by enabling the :option:`--limit-tu` option. +6. The bitrate target for x265 can now be dynamically reconfigured via the reconfigure API. +7. Performance optimized SAO algorithm introduced via the :option:`--limit-sao` option; seeing 10% speed benefits at faster presets. + +API changes +----------- +1. x265_reconfigure API now also accepts rate-control parameters for dynamic reconfiguration. +2. Several additions to data fields in x265_analysis to support :option:`--refine-level`: see x265.h for more details. + +Bug fixes +--------- +1. Avoid negative offsets in x265 lambda2 table with SAO enabled. +2. Fix mingw32 build error. +3. Seek now enabled for pipe input, in addition to file-based input +4. Fix issue of statically linking core-utils not working in linux. +5. Fix visual artifacts with :option:`--multi-pass-opt-distortion` with VBV. +6. Fix bufferFill stats reported in csv. + Version 2.3 ===========
View file
x265_2.3.tar.gz/source/CMakeLists.txt -> x265_2.4.tar.gz/source/CMakeLists.txt
Changed
@@ -29,7 +29,7 @@ option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF) mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD) # X265_BUILD must be incremented each time the public API is changed -set(X265_BUILD 110) +set(X265_BUILD 116) configure_file("${PROJECT_SOURCE_DIR}/x265.def.in" "${PROJECT_BINARY_DIR}/x265.def") configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in" @@ -255,7 +255,7 @@ endif(FPROFILE_USE) if(STATIC_LINK_CRT) add_definitions(-static) - list(APPEND LINKER_OPTIONS "-static") + list(APPEND LINKER_OPTIONS "-static-libgcc") endif(STATIC_LINK_CRT) check_cxx_compiler_flag(-Wno-strict-overflow CC_HAS_NO_STRICT_OVERFLOW) check_cxx_compiler_flag(-Wno-narrowing CC_HAS_NO_NARROWING) @@ -363,6 +363,13 @@ else(HIGH_BIT_DEPTH) add_definitions(-DHIGH_BIT_DEPTH=0 -DX265_DEPTH=8) endif(HIGH_BIT_DEPTH) +# this option is to enable the inclusion of dynamic HDR10 library to the libx265 compilation +option(ENABLE_DYNAMIC_HDR10 "Enable dynamic HDR10 compilation" OFF) +if (ENABLE_DYNAMIC_HDR10) + add_subdirectory(dynamicHDR10) + include_directories(dynamicHDR10) + add_definitions(-DENABLE_DYNAMIC_HDR10) +endif(ENABLE_DYNAMIC_HDR10) # this option can only be used when linking multiple libx265 libraries # together, and some alternate API access method is implemented. @@ -502,9 +509,12 @@ endforeach() endif() endif() - source_group(ASM FILES ${ASM_SRCS}) -add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS} ${ASM_SRCS}) +if(ENABLE_DYNAMIC_HDR10) + add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS} ${ASM_SRCS}) +else() + add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS} ${ASM_SRCS}) +endif() if(NOT MSVC) set_target_properties(x265-static PROPERTIES OUTPUT_NAME x265) endif() @@ -535,11 +545,16 @@ if(NOT (MSVC_IDE OR XCODE)) add_custom_target(clean-generated COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/clean-generated.cmake) endif() - option(ENABLE_SHARED "Build shared library" ON) if(ENABLE_SHARED) - add_library(x265-shared SHARED "${PROJECT_BINARY_DIR}/x265.def" ${ASM_OBJS} - ${X265_RC_FILE} $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>) + + if(ENABLE_DYNAMIC_HDR10) + add_library(x265-shared SHARED "${PROJECT_BINARY_DIR}/x265.def" ${ASM_OBJS} + ${X265_RC_FILE} $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10>) + else() + add_library(x265-shared SHARED "${PROJECT_BINARY_DIR}/x265.def" ${ASM_OBJS} + ${X265_RC_FILE} $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>) + endif() if(EXTRA_LIB) target_link_libraries(x265-shared ${EXTRA_LIB}) endif() @@ -629,12 +644,17 @@ if(WIN32) set(ExportDefs "${PROJECT_BINARY_DIR}/x265.def") endif(WIN32) - if(XCODE) # Xcode seems unable to link the CLI with libs, so link as one targget + if(ENABLE_DYNAMIC_HDR10) add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} - x265.cpp x265.h x265cli.h x265-extras.h x265-extras.cpp - $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS} ${ASM_SRCS}) + x265.cpp x265.h x265cli.h x265-extras.h x265-extras.cpp + $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS} ${ASM_SRCS}) + else() + add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} + x265.cpp x265.h x265cli.h x265-extras.h x265-extras.cpp + $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS} ${ASM_SRCS}) + endif() else() add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} ${X265_RC_FILE} ${ExportDefs} x265.cpp x265.h x265cli.h x265-extras.h x265-extras.cpp)
View file
x265_2.3.tar.gz/source/cmake/FindNuma.cmake -> x265_2.4.tar.gz/source/cmake/FindNuma.cmake
Changed
@@ -14,7 +14,7 @@ # NUMA_LIBRARY # Points to the libnuma that can be passed to target_link_libararies. # -# Copyright (c) 2015 Steve Borho +# Copyright (c) 2013-2017 MulticoreWare, Inc include(FindPackageHandleStandardArgs)
View file
x265_2.3.tar.gz/source/cmake/FindVLD.cmake -> x265_2.4.tar.gz/source/cmake/FindVLD.cmake
Changed
@@ -23,7 +23,7 @@ # target_link_libararies. # # -# Copyright (c) 2012 Sergiu Dotenco +# Copyright (c) 2013-2017 MulticoreWare, Inc # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal
View file
x265_2.3.tar.gz/source/cmake/FindVtune.cmake -> x265_2.4.tar.gz/source/cmake/FindVtune.cmake
Changed
@@ -5,7 +5,7 @@ # VTUNE_INCLUDE_DIR: Points to the vtunes include dir # VTUNE_LIBRARY_DIR: Points to the directory with libraries # -# Copyright (c) 2015 Pradeep Ramachandran +# Copyright (c) 2013-2017 MulticoreWare, Inc include(FindPackageHandleStandardArgs)
View file
x265_2.3.tar.gz/source/common/arm/asm-primitives.cpp -> x265_2.4.tar.gz/source/common/arm/asm-primitives.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Praveen Kumar Tiwari <praveen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/arm/asm.S -> x265_2.4.tar.gz/source/common/arm/asm.S
Changed
@@ -1,7 +1,7 @@ /***************************************************************************** * asm.S: arm utility macros ***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Mans Rullgard <mans@mansr.com> * David Conrad <lessen42@gmail.com>
View file
x265_2.3.tar.gz/source/common/arm/blockcopy8.S -> x265_2.4.tar.gz/source/common/arm/blockcopy8.S
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Radhakrishnan VR <radhakrishnan@multicorewareinc.com> *
View file
x265_2.3.tar.gz/source/common/arm/blockcopy8.h -> x265_2.4.tar.gz/source/common/arm/blockcopy8.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/arm/cpu-a.S -> x265_2.4.tar.gz/source/common/arm/cpu-a.S
Changed
@@ -1,7 +1,7 @@ /***************************************************************************** * cpu-a.S: arm cpu detection ***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: David Conrad <lessen42@gmail.com> * Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/arm/dct-a.S -> x265_2.4.tar.gz/source/common/arm/dct-a.S
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Min Chen <chenm003@163.com> *
View file
x265_2.3.tar.gz/source/common/arm/dct8.h -> x265_2.4.tar.gz/source/common/arm/dct8.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Min Chen <chenm003@163.com> * Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/arm/intrapred.h -> x265_2.4.tar.gz/source/common/arm/intrapred.h
Changed
@@ -1,7 +1,7 @@ /***************************************************************************** * intrapred.h: Intra Prediction metrics ***************************************************************************** - * Copyright (C) 2003-2013 x264 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com> * Praveen Kumar Tiwari <praveen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/arm/ipfilter8.S -> x265_2.4.tar.gz/source/common/arm/ipfilter8.S
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Dnyaneshwar G <dnyaneshwar@multicorewareinc.com> * Radhakrishnan VR <radhakrishnan@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/arm/ipfilter8.h -> x265_2.4.tar.gz/source/common/arm/ipfilter8.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/arm/loopfilter.h -> x265_2.4.tar.gz/source/common/arm/loopfilter.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com> * Praveen Kumar Tiwari <praveen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/arm/mc-a.S -> x265_2.4.tar.gz/source/common/arm/mc-a.S
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com> * Radhakrishnan <radhakrishnan@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/arm/mc.h -> x265_2.4.tar.gz/source/common/arm/mc.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/arm/pixel-util.S -> x265_2.4.tar.gz/source/common/arm/pixel-util.S
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Dnyaneshwar G <dnyaneshwar@multicorewareinc.com> * Radhakrishnan VR <radhakrishnan@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/arm/pixel-util.h -> x265_2.4.tar.gz/source/common/arm/pixel-util.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> ;* Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/arm/pixel.h -> x265_2.4.tar.gz/source/common/arm/pixel.h
Changed
@@ -1,8 +1,8 @@ /***************************************************************************** * pixel.h: x86 pixel metrics ***************************************************************************** - * Copyright (C) 2003-2013 x264 project - * Copyright (C) 2013-2016 x265 project + * Copyright (C) 2003-2017 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Laurent Aimar <fenrir@via.ecp.fr> * Loren Merritt <lorenm@u.washington.edu>
View file
x265_2.3.tar.gz/source/common/arm/sad-a.S -> x265_2.4.tar.gz/source/common/arm/sad-a.S
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: David Conrad <lessen42@gmail.com> * Janne Grunau <janne-x264@jannau.net>
View file
x265_2.3.tar.gz/source/common/arm/ssd-a.S -> x265_2.4.tar.gz/source/common/arm/ssd-a.S
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Dnyaneshwar G <dnyaneshwar@multicorewareinc.com> *
View file
x265_2.3.tar.gz/source/common/bitstream.cpp -> x265_2.4.tar.gz/source/common/bitstream.cpp
Changed
@@ -64,9 +64,9 @@ switch (writeBytes) { - case 4: push_back(write_bits >> 24); - case 3: push_back(write_bits >> 16); - case 2: push_back(write_bits >> 8); + case 4: push_back(write_bits >> 24); // fall-through + case 3: push_back(write_bits >> 16); // fall-through + case 2: push_back(write_bits >> 8); // fall-through case 1: push_back(write_bits); }
View file
x265_2.3.tar.gz/source/common/bitstream.h -> x265_2.4.tar.gz/source/common/bitstream.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Author: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/common.cpp -> x265_2.4.tar.gz/source/common/common.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com> *
View file
x265_2.3.tar.gz/source/common/common.h -> x265_2.4.tar.gz/source/common/common.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/constants.cpp -> x265_2.4.tar.gz/source/common/constants.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2015 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -49,23 +49,23 @@ 7298.2423, 8192.0000, 9195.2091, 10321.2732, 11585.2375 }; -// lambda2 = pow(lambda, 2) * scale (0.85); +// lambda2 = 0.038 * EXP(0.234 * QP) * 256; double x265_lambda2_tab[QP_MAX_MAX + 1] = { - 13.6000, 17.1349, 21.5887, 27.2000, 34.2699, - 43.1773, 54.4000, 68.5397, 86.3546, 108.8000, - 137.0794, 172.7092, 217.6000, 274.1588, 345.4185, - 435.2000, 548.3176, 690.8369, 870.4000, 1096.6353, - 1381.6739, 1740.8000, 2193.2706, 2763.3478, 3481.6000, - 4386.5411, 5526.6955, 6963.2000, 8773.0822, 11053.3910, - 13926.4000, 17546.1645, 22106.7819, 27852.8000, 35092.3291, - 44213.5641, 55705.6000, 70184.6579, 88427.1282, 111411.2000, - 140369.3159, 176854.2563, 222822.4000, 280738.6324, 353708.5127, - 445644.8001, 561477.2648, 707417.0237, 891289.6000, 1122954.5277, - 1414834.0484, 1782579.2003, 2245909.0566, 2829668.0981, 3565158.4000, - 4491818.1146, 5659336.1938, 7130316.8013, 8983636.2264, 11318672.3923, - 14260633.6000, 17967272.4585, 22637344.7751, 28521267.1953, 35934544.9165, - 45274689.5567, 57042534.4000, 71869089.8338, 90549379.1181, 114085068.8008 + 9.7280, 12.2880, 15.5136, 19.6096, 24.7808, + 31.3344, 39.6032, 50.0480, 63.2320, 79.8976, + 100.9664, 127.5904, 161.2544, 203.7504, 257.4848, + 325.3760, 411.1616, 519.5520, 656.5376, 829.6448, + 1048.3712, 1324.7744, 1674.0608, 2115.4048, 2673.1264, + 3377.8944, 4268.4416, 5393.7920, 6815.8464, 8612.8128, + 10883.5328, 13752.9344, 17378.8160, 21960.6528, 27750.4768, + 35066.7264, 44311.8848, 55994.4704, 70757.0944, 89411.8144, + 112984.7552, 142772.5824, 180413.7728, 227978.8800, 288084.2496, + 364036.0960, 460012.2112, 581291.8784, 734546.3040, 928205.3888, + 1172921.6256, 1482155.9552, 1872918.2208, 2366702.7968, 2990670.9504, + 3779144.8832, 4775495.6288, 6034528.7424, 7625499.0080, 9635919.8464, + 12176377.0368, 15386611.7888, 19443207.2448, 24569301.7344, 31046862.8224, + 39232197.1968, 49575549.9264, 62645870.6176, 79162109.3632, 100032763.4688 }; #elif X265_DEPTH == 10 @@ -89,23 +89,23 @@ 1824.5606, 2048.0000, 2298.8023, 2580.3183, 2896.3094, }; -// lambda2 = pow(lambda, 2) * scale (0.85); +// lambda2 = 0.038 * exp(0.234 * QP) * 16; double x265_lambda2_tab[QP_MAX_MAX + 1] = { - 0.8500, 1.0709, 1.3493, 1.7000, 2.1419, - 2.6986, 3.4000, 4.2837, 5.3972, 6.8000, - 8.5675, 10.7943, 13.6000, 17.1349, 21.5887, - 27.2000, 34.2699, 43.1773, 54.4000, 68.5397, - 86.3546, 108.8000, 137.0794, 172.7092, 217.6000, - 274.1588, 345.4185, 435.2000, 548.3176, 690.8369, - 870.4000, 1096.6353, 1381.6739, 1740.8000, 2193.2706, - 2763.3478, 3481.6000, 4386.5411, 5526.6955, 6963.2000, - 8773.0823, 11053.3910, 13926.4000, 17546.1645, 22106.7820, - 27852.8000, 35092.3290, 44213.5640, 55705.6000, 70184.6580, - 88427.1280, 111411.2000, 140369.3161, 176854.2561, 222822.4000, - 280738.6321, 353708.5122, 445644.8000, 561477.2643, 707417.0243, - 891289.6000, 1122954.5286, 1414834.0486, 1782579.2000, 2245909.0572, - 2829668.0973, 3565158.4000, 4491818.1144, 5659336.1946, 7130316.8000, + 0.6080, 0.7680, 0.9696, 1.2256, 1.5488, + 1.9584, 2.4752, 3.1280, 3.9520, 4.9936, + 6.3104, 7.9744, 10.0784, 12.7344, 16.0928, + 20.3360, 25.6976, 32.4720, 41.0336, 51.8528, + 65.5232, 82.7984, 104.6288, 132.2128, 167.0704, + 211.1184, 266.7776, 337.1120, 425.9904, 538.3008, + 680.2208, 859.5584, 1086.1760, 1372.5408, 1734.4048, + 2191.6704, 2769.4928, 3499.6544, 4422.3184, 5588.2384, + 7061.5472, 8923.2864, 11275.8608, 14248.6800, 18005.2656, + 22752.2560, 28750.7632, 36330.7424, 45909.1440, 58012.8368, + 73307.6016, 92634.7472, 117057.3888, 147918.9248, 186916.9344, + 236196.5552, 298468.4768, 377158.0464, 476593.6880, 602244.9904, + 761023.5648, 961663.2368, 1215200.4528, 1535581.3584, 1940428.9264, + 2452012.3248, 3098471.8704, 3915366.9136, 4947631.8352, 6252047.7168 }; #else /* !HIGH_BIT_DEPTH */ @@ -129,23 +129,23 @@ 456.1401, 512.0000, 574.7006, 645.0796, 724.0773 }; -// lambda2 = pow(lambda, 2) * scale (0.85); +// lambda2 = 0.038 * exp(0.234 * QP) double x265_lambda2_tab[QP_MAX_MAX + 1] = { - 0.0531, 0.0669, 0.0843, 0.1063, 0.1339, - 0.1687, 0.2125, 0.2677, 0.3373, 0.4250, - 0.5355, 0.6746, 0.8500, 1.0709, 1.3493, - 1.7000, 2.1419, 2.6986, 3.4000, 4.2837, - 5.3970, 6.8000, 8.5675, 10.7943, 13.6000, - 17.1345, 21.5887, 27.2004, 34.2699, 43.1773, - 54.4000, 68.5397, 86.3551, 108.7998, 137.0792, - 172.7097, 217.6000, 274.1590, 345.4172, 435.1993, - 548.3169, 690.8389, 870.4000, 1096.6362, 1381.6757, - 1740.7974, 2193.2676, 2763.3460, 3481.6000, 4386.5446, - 5526.6890, 6963.2049, 8773.0879, 11053.3840, 13926.4000, - 17546.1542, 22106.7835, 27852.7889, 35092.3170, 44213.5749, - 55705.6000, 70184.6657, 88427.1342, 111411.2172, 140369.3373, - 176854.2222, 222822.4000, 280738.6627, 353708.5368, 445644.7459 + 0.0380, 0.0480, 0.0606, 0.0766, 0.0968, + 0.1224, 0.1547, 0.1955, 0.2470, 0.3121, + 0.3944, 0.4984, 0.6299, 0.7959, 1.0058, + 1.2710, 1.6061, 2.0295, 2.5646, 3.2408, + 4.0952, 5.1749, 6.5393, 8.2633, 10.4419, + 13.1949, 16.6736, 21.0695, 26.6244, 33.6438, + 42.5138, 53.7224, 67.8860, 85.7838, 108.4003, + 136.9794, 173.0933, 218.7284, 276.3949, 349.2649, + 441.3467, 557.7054, 704.7413, 890.5425, 1125.3291, + 1422.0160, 1796.9227, 2270.6714, 2869.3215, 3625.8023, + 4581.7251, 5789.6717, 7316.0868, 9244.9328, 11682.3084, + 14762.2847, 18654.2798, 23572.3779, 29787.1055, 37640.3119, + 47563.9728, 60103.9523, 75950.0283, 95973.8349, 121276.8079, + 153250.7703, 193654.4919, 244710.4321, 309226.9897, 390752.9823 }; #endif
View file
x265_2.3.tar.gz/source/common/constants.h -> x265_2.4.tar.gz/source/common/constants.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/contexts.h -> x265_2.4.tar.gz/source/common/contexts.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2015 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/cpu.cpp -> x265_2.4.tar.gz/source/common/cpu.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Loren Merritt <lorenm@u.washington.edu> * Laurent Aimar <fenrir@via.ecp.fr>
View file
x265_2.3.tar.gz/source/common/cpu.h -> x265_2.4.tar.gz/source/common/cpu.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Loren Merritt <lorenm@u.washington.edu> * Steve Borho <steve@borho.org>
View file
x265_2.3.tar.gz/source/common/cudata.cpp -> x265_2.4.tar.gz/source/common/cudata.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/cudata.h -> x265_2.4.tar.gz/source/common/cudata.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/dct.cpp -> x265_2.4.tar.gz/source/common/dct.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Mandar Gurav <mandar@multicorewareinc.com> * Deepthi Devaki Akkoorath <deepthidevaki@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/deblock.cpp -> x265_2.4.tar.gz/source/common/deblock.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Author: Gopu Govindaswamy <gopu@multicorewareinc.com> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/deblock.h -> x265_2.4.tar.gz/source/common/deblock.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Author: Gopu Govindaswamy <gopu@multicorewareinc.com> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/frame.cpp -> x265_2.4.tar.gz/source/common/frame.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Author: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -47,6 +47,7 @@ memset(&m_lowres, 0, sizeof(m_lowres)); m_rcData = NULL; m_encodeStartTime = 0; + m_reconfigureRc = false; } bool Frame::create(x265_param *param, float* quantOffsets)
View file
x265_2.3.tar.gz/source/common/frame.h -> x265_2.4.tar.gz/source/common/frame.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Author: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -60,6 +60,12 @@ int encodeOrder; int sliceType; int keptAsRef; + double wantedBitsWindow; + double cplxrSum; + double shortTermCplxSum; + double shortTermCplxCount; + int64_t totalBits; + int64_t encodedBits; }; class Frame @@ -84,6 +90,7 @@ Lowres m_lowres; bool m_lowresInit; // lowres init complete (pre-analysis) bool m_bChromaExtended; // orig chroma planes motion extended for weight analysis + bool m_reconfigureRc; float* m_quantOffsets; // points to quantOffsets in x265_picture x265_sei m_userSEI;
View file
x265_2.3.tar.gz/source/common/framedata.cpp -> x265_2.4.tar.gz/source/common/framedata.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Author: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/framedata.h -> x265_2.4.tar.gz/source/common/framedata.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Author: Steve Borho <steve@borho.org> * @@ -176,12 +176,15 @@ /* Stores inter analysis data for a single frame */ struct analysis_inter_data { - WeightParam* wt; int32_t* ref; uint8_t* depth; uint8_t* modes; uint8_t* partSize; uint8_t* mergeFlag; + uint8_t* interDir; + uint8_t* mvpIdx[2]; + int8_t* refIdx[2]; + MV* mv[2]; }; struct analysis2PassFrameData
View file
x265_2.3.tar.gz/source/common/intrapred.cpp -> x265_2.4.tar.gz/source/common/intrapred.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Min Chen <chenm003@163.com> *
View file
x265_2.3.tar.gz/source/common/ipfilter.cpp -> x265_2.4.tar.gz/source/common/ipfilter.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Devaki <deepthidevaki@multicorewareinc.com>, * Rajesh Paulraj <rajesh@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/loopfilter.cpp -> x265_2.4.tar.gz/source/common/loopfilter.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Praveen Kumar Tiwari <praveen@multicorewareinc.com> * Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/lowres.cpp -> x265_2.4.tar.gz/source/common/lowres.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com> *
View file
x265_2.3.tar.gz/source/common/lowres.h -> x265_2.4.tar.gz/source/common/lowres.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com> *
View file
x265_2.3.tar.gz/source/common/md5.cpp -> x265_2.4.tar.gz/source/common/md5.cpp
Changed
@@ -1,7 +1,7 @@ /***************************************************************************** * md5.cpp: Calculate MD5 for SEI ***************************************************************************** - * Copyright (C) 2011-2012 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Min Chen <chenm003@163.com> *
View file
x265_2.3.tar.gz/source/common/md5.h -> x265_2.4.tar.gz/source/common/md5.h
Changed
@@ -1,7 +1,7 @@ /***************************************************************************** * md5.h: Calculate MD5 ***************************************************************************** - * Copyright (C) 2011-2012 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Min Chen <chenm003@163.com> *
View file
x265_2.3.tar.gz/source/common/mv.h -> x265_2.4.tar.gz/source/common/mv.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/param.cpp -> x265_2.4.tar.gz/source/common/param.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com> * Min Chen <min.chen@multicorewareinc.com> @@ -187,7 +187,7 @@ /* SAO Loop Filter */ param->bEnableSAO = 1; param->bSaoNonDeblocked = 0; - + param->bLimitSAO = 0; /* Coding Quality */ param->cbQpOffset = 0; param->crQpOffset = 0; @@ -270,7 +270,11 @@ param->bOptRefListLengthPPS = 1; param->bOptCUDeltaQP = 0; param->bAQMotion = 0; + param->bHDROpt = 0; + param->analysisRefineLevel = 5; + param->toneMapFile = NULL; + param->bDhdr10opt = 0; } int x265_param_default_preset(x265_param* param, const char* preset, const char* tune) @@ -394,6 +398,7 @@ param->limitModes = 1; param->bIntraInBFrames = 1; param->lookaheadSlices = 4; // limit parallelism as already enough work exists + param->limitTU = 4; } else if (!strcmp(preset, "veryslow")) { @@ -415,6 +420,7 @@ param->limitModes = 1; param->bIntraInBFrames = 1; param->lookaheadSlices = 0; // disabled for best quality + param->limitTU = 4; } else if (!strcmp(preset, "placebo")) { @@ -932,6 +938,7 @@ OPT("multi-pass-opt-distortion") p->analysisMultiPassDistortion = atobool(value); OPT("aq-motion") p->bAQMotion = atobool(value); OPT("dynamic-rd") p->dynamicRd = atof(value); + OPT("refine-level") p->analysisRefineLevel = atoi(value); OPT("ssim-rd") { int bval = atobool(value); @@ -943,6 +950,10 @@ } } OPT("hdr") p->bEmitHDRSEI = atobool(value); + OPT("hdr-opt") p->bHDROpt = atobool(value); + OPT("limit-sao") p->bLimitSAO = atobool(value); + OPT("dhdr10-info") p->toneMapFile = strdup(value); + OPT("dhdr10-opt") p->bDhdr10opt = atobool(value); else return X265_PARAM_BAD_NAME; } @@ -1275,6 +1286,8 @@ "Strict-cbr cannot be applied without specifying target bitrate or vbv bufsize"); CHECK(param->analysisMode && (param->analysisMode < X265_ANALYSIS_OFF || param->analysisMode > X265_ANALYSIS_LOAD), "Invalid analysis mode. Analysis mode 0: OFF 1: SAVE : 2 LOAD"); + CHECK(param->analysisMode && (param->analysisRefineLevel < 1 || param->analysisRefineLevel > 10), + "Invalid analysis refine level. Value must be between 1 and 10 (inclusive)"); CHECK(param->rc.qpMax < QP_MIN || param->rc.qpMax > QP_MAX_MAX, "qpmax exceeds supported range (0 to 69)"); CHECK(param->rc.qpMin < QP_MIN || param->rc.qpMin > QP_MAX_MAX, @@ -1423,6 +1436,7 @@ TOOLOPT(param->limitModes, "limit-modes"); TOOLVAL(param->rdLevel, "rd=%d"); TOOLVAL(param->dynamicRd, "dynamic-rd=%.2f"); + TOOLOPT(param->bSsimRd, "ssim-rd"); TOOLVAL(param->psyRd, "psy-rd=%.2lf"); TOOLVAL(param->rdoqLevel, "rdoq=%d"); TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf"); @@ -1459,6 +1473,9 @@ TOOLOPT(!param->bSaoNonDeblocked && param->bEnableSAO, "sao"); TOOLOPT(param->rc.bStatWrite, "stats-write"); TOOLOPT(param->rc.bStatRead, "stats-read"); +#if ENABLE_DYNAMIC_HDR10 + TOOLVAL(param->toneMapFile != NULL, "dhdr10-info"); +#endif x265_log(param, X265_LOG_INFO, "tools:%s\n", buf); fflush(stderr); } @@ -1523,6 +1540,7 @@ s += sprintf(s, " limit-tu=%d", p->limitTU); s += sprintf(s, " rdoq-level=%d", p->rdoqLevel); s += sprintf(s, " dynamic-rd=%.2f", p->dynamicRd); + BOOL(p->bSsimRd, "ssim-rd"); BOOL(p->bEnableSignHiding, "signhide"); BOOL(p->bEnableTransformSkip, "tskip"); s += sprintf(s, " nr-intra=%d", p->noiseReductionIntra); @@ -1648,6 +1666,10 @@ BOOL(p->bOptCUDeltaQP, "opt-cu-delta-qp"); BOOL(p->bAQMotion, "aq-motion"); BOOL(p->bEmitHDRSEI, "hdr"); + BOOL(p->bHDROpt, "hdr-opt"); + BOOL(p->bDhdr10opt, "dhdr10-opt"); + s += sprintf(s, " refine-level=%d", p->analysisRefineLevel); + BOOL(p->bLimitSAO, "limit-sao"); #undef BOOL return buf; } @@ -1657,10 +1679,10 @@ if (!param->rc.lambdaFileName) return false; - FILE *lfn = fopen(param->rc.lambdaFileName, "r"); + FILE *lfn = x265_fopen(param->rc.lambdaFileName, "r"); if (!lfn) { - x265_log(param, X265_LOG_ERROR, "unable to read lambda file <%s>\n", param->rc.lambdaFileName); + x265_log_file(param, X265_LOG_ERROR, "unable to read lambda file <%s>\n", param->rc.lambdaFileName); return true; }
View file
x265_2.3.tar.gz/source/common/param.h -> x265_2.4.tar.gz/source/common/param.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com> * Praveen Kumar Tiwari <praveen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/piclist.cpp -> x265_2.4.tar.gz/source/common/piclist.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com> *
View file
x265_2.3.tar.gz/source/common/piclist.h -> x265_2.4.tar.gz/source/common/piclist.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com> *
View file
x265_2.3.tar.gz/source/common/picyuv.cpp -> x265_2.4.tar.gz/source/common/picyuv.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/picyuv.h -> x265_2.4.tar.gz/source/common/picyuv.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/pixel.cpp -> x265_2.4.tar.gz/source/common/pixel.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Mandar Gurav <mandar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/ppc/dct_altivec.cpp -> x265_2.4.tar.gz/source/common/ppc/dct_altivec.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Roger Moussalli <rmoussal@us.ibm.com> * Min Chen <min.chen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/ppc/intrapred_altivec.cpp -> x265_2.4.tar.gz/source/common/ppc/intrapred_altivec.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Roger Moussalli <rmoussal@us.ibm.com> * Min Chen <min.chen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/ppc/ipfilter_altivec.cpp -> x265_2.4.tar.gz/source/common/ppc/ipfilter_altivec.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Roger Moussalli <rmoussal@us.ibm.com> * Min Chen <min.chen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/ppc/pixel_altivec.cpp -> x265_2.4.tar.gz/source/common/ppc/pixel_altivec.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Mandar Gurav <mandar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/ppc/ppccommon.h -> x265_2.4.tar.gz/source/common/ppc/ppccommon.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Min Chen <min.chen@multicorewareinc.com> *
View file
x265_2.3.tar.gz/source/common/predict.cpp -> x265_2.4.tar.gz/source/common/predict.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/predict.h -> x265_2.4.tar.gz/source/common/predict.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/primitives.cpp -> x265_2.4.tar.gz/source/common/primitives.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/primitives.h -> x265_2.4.tar.gz/source/common/primitives.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Mandar Gurav <mandar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/quant.cpp -> x265_2.4.tar.gz/source/common/quant.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -225,8 +225,8 @@ m_rdoqLevel = ctu.m_encData->m_param->rdoqLevel; if (ctu.m_chromaFormat != X265_CSP_I400) { - setChromaQP(qp + ctu.m_slice->m_pps->chromaQpOffset[0], TEXT_CHROMA_U, ctu.m_chromaFormat); - setChromaQP(qp + ctu.m_slice->m_pps->chromaQpOffset[1], TEXT_CHROMA_V, ctu.m_chromaFormat); + setChromaQP(qp + ctu.m_slice->m_pps->chromaQpOffset[0] + ctu.m_slice->m_chromaQpOffset[0], TEXT_CHROMA_U, ctu.m_chromaFormat); + setChromaQP(qp + ctu.m_slice->m_pps->chromaQpOffset[1] + ctu.m_slice->m_chromaQpOffset[1], TEXT_CHROMA_V, ctu.m_chromaFormat); } }
View file
x265_2.3.tar.gz/source/common/quant.h -> x265_2.4.tar.gz/source/common/quant.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/scalinglist.cpp -> x265_2.4.tar.gz/source/common/scalinglist.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * @@ -245,10 +245,10 @@ bool ScalingList::parseScalingList(const char* filename) { - FILE *fp = fopen(filename, "r"); + FILE *fp = x265_fopen(filename, "r"); if (!fp) { - x265_log(NULL, X265_LOG_ERROR, "can't open scaling list file %s\n", filename); + x265_log_file(NULL, X265_LOG_ERROR, "can't open scaling list file %s\n", filename); return true; } @@ -268,7 +268,7 @@ char *ret = fgets(line, 1024, fp); if (!ret || (!strstr(line, MatrixType[sizeIdc][listIdc]) && feof(fp))) { - x265_log(NULL, X265_LOG_ERROR, "can't read matrix from %s\n", filename); + x265_log_file(NULL, X265_LOG_ERROR, "can't read matrix from %s\n", filename); return true; } } @@ -279,7 +279,7 @@ int data; if (fscanf(fp, "%d,", &data) != 1) { - x265_log(NULL, X265_LOG_ERROR, "can't read matrix from %s\n", filename); + x265_log_file(NULL, X265_LOG_ERROR, "can't read matrix from %s\n", filename); return true; } src[i] = data; @@ -295,7 +295,7 @@ char *ret = fgets(line, 1024, fp); if (!ret || (!strstr(line, MatrixType_DC[sizeIdc][listIdc]) && feof(fp))) { - x265_log(NULL, X265_LOG_ERROR, "can't read DC from %s\n", filename); + x265_log_file(NULL, X265_LOG_ERROR, "can't read DC from %s\n", filename); return true; } } @@ -304,7 +304,7 @@ int data; if (fscanf(fp, "%d,", &data) != 1) { - x265_log(NULL, X265_LOG_ERROR, "can't read matrix from %s\n", filename); + x265_log_file(NULL, X265_LOG_ERROR, "can't read matrix from %s\n", filename); return true; }
View file
x265_2.3.tar.gz/source/common/scalinglist.h -> x265_2.4.tar.gz/source/common/scalinglist.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/shortyuv.cpp -> x265_2.4.tar.gz/source/common/shortyuv.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com> *
View file
x265_2.3.tar.gz/source/common/shortyuv.h -> x265_2.4.tar.gz/source/common/shortyuv.h
Changed
@@ -1,7 +1,7 @@ /***************************************************************************** * x265: ShortYUV class for short sized YUV-style frames ***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com> *
View file
x265_2.3.tar.gz/source/common/slice.cpp -> x265_2.4.tar.gz/source/common/slice.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/slice.h -> x265_2.4.tar.gz/source/common/slice.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -289,6 +289,7 @@ bool bPicDisableDeblockingFilter; int numRefIdxDefault[2]; + bool pps_slice_chroma_qp_offsets_present_flag; }; struct WeightParam @@ -339,6 +340,7 @@ NalUnitType m_nalUnitType; SliceType m_sliceType; int m_sliceQp; + int m_chromaQpOffset[2]; int m_poc; int m_lastIDR; int m_rpsIdx; @@ -372,6 +374,7 @@ numRefIdxDefault[0] = 1; numRefIdxDefault[1] = 1; m_rpsIdx = -1; + m_chromaQpOffset[0] = m_chromaQpOffset[1] = 0; } void disableWeights();
View file
x265_2.3.tar.gz/source/common/threading.cpp -> x265_2.4.tar.gz/source/common/threading.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/threading.h -> x265_2.4.tar.gz/source/common/threading.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/threadpool.cpp -> x265_2.4.tar.gz/source/common/threadpool.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/threadpool.h -> x265_2.4.tar.gz/source/common/threadpool.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/vec/dct-sse3.cpp -> x265_2.4.tar.gz/source/common/vec/dct-sse3.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Mandar Gurav <mandar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/vec/dct-sse41.cpp -> x265_2.4.tar.gz/source/common/vec/dct-sse41.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Mandar Gurav <mandar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/vec/dct-ssse3.cpp -> x265_2.4.tar.gz/source/common/vec/dct-ssse3.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Mandar Gurav <mandar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/vec/vec-primitives.cpp -> x265_2.4.tar.gz/source/common/vec/vec-primitives.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/version.cpp -> x265_2.4.tar.gz/source/common/version.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/wavefront.cpp -> x265_2.4.tar.gz/source/common/wavefront.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/wavefront.h -> x265_2.4.tar.gz/source/common/wavefront.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/winxp.cpp -> x265_2.4.tar.gz/source/common/winxp.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/winxp.h -> x265_2.4.tar.gz/source/common/winxp.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/x86/asm-primitives.cpp -> x265_2.4.tar.gz/source/common/x86/asm-primitives.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Praveen Kumar Tiwari <praveen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/blockcopy8.asm -> x265_2.4.tar.gz/source/common/x86/blockcopy8.asm
Changed
@@ -1,5 +1,5 @@ ;***************************************************************************** -;* Copyright (C) 2013 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Praveen Kumar Tiwari <praveen@multicorewareinc.com> ;* Murugan Vairavel <murugan@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/blockcopy8.h -> x265_2.4.tar.gz/source/common/x86/blockcopy8.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> ;* Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/x86/const-a.asm -> x265_2.4.tar.gz/source/common/x86/const-a.asm
Changed
@@ -1,8 +1,8 @@ ;***************************************************************************** ;* const-a.asm: x86 global constants ;***************************************************************************** -;* Copyright (C) 2010-2013 x264 project -;* Copyright (C) 2013-2015 x265 project +;* Copyright (C) 2003-2013 x264 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Fiona Glaser <fiona@x264.com>
View file
x265_2.3.tar.gz/source/common/x86/cpu-a.asm -> x265_2.4.tar.gz/source/common/x86/cpu-a.asm
Changed
@@ -2,7 +2,7 @@ ;* cpu-a.asm: x86 cpu utilities ;***************************************************************************** ;* Copyright (C) 2003-2013 x264 project -;* Copyright (C) 2013-2015 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Laurent Aimar <fenrir@via.ecp.fr> ;* Loren Merritt <lorenm@u.washington.edu>
View file
x265_2.3.tar.gz/source/common/x86/dct8.asm -> x265_2.4.tar.gz/source/common/x86/dct8.asm
Changed
@@ -1,5 +1,5 @@ ;***************************************************************************** -;* Copyright (C) 2013 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Nabajit Deka <nabajit@multicorewareinc.com> ;* Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/dct8.h -> x265_2.4.tar.gz/source/common/x86/dct8.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Nabajit Deka <nabajit@multicorewareinc.com> ;* Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/x86/intrapred.h -> x265_2.4.tar.gz/source/common/x86/intrapred.h
Changed
@@ -2,6 +2,7 @@ * intrapred.h: Intra Prediction metrics ***************************************************************************** * Copyright (C) 2003-2013 x264 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com> * Praveen Kumar Tiwari <praveen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/intrapred16.asm -> x265_2.4.tar.gz/source/common/x86/intrapred16.asm
Changed
@@ -1,5 +1,5 @@ ;***************************************************************************** -;* Copyright (C) 2013 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com> ;* Yuvaraj Venkatesh <yuvaraj@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/intrapred8.asm -> x265_2.4.tar.gz/source/common/x86/intrapred8.asm
Changed
@@ -1,5 +1,5 @@ ;***************************************************************************** -;* Copyright (C) 2013 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com> ;* Praveen Kumar Tiwari <praveen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/intrapred8_allangs.asm -> x265_2.4.tar.gz/source/common/x86/intrapred8_allangs.asm
Changed
@@ -1,5 +1,5 @@ ;***************************************************************************** -;* Copyright (C) 2013 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com> ;* Praveen Tiwari <praveen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/ipfilter16.asm -> x265_2.4.tar.gz/source/common/x86/ipfilter16.asm
Changed
@@ -1,5 +1,5 @@ ;***************************************************************************** -;* Copyright (C) 2013 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Nabajit Deka <nabajit@multicorewareinc.com> ;* Murugan Vairavel <murugan@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/ipfilter8.asm -> x265_2.4.tar.gz/source/common/x86/ipfilter8.asm
Changed
@@ -1,5 +1,5 @@ ;***************************************************************************** -;* Copyright (C) 2013 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Min Chen <chenm003@163.com> ;* Nabajit Deka <nabajit@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/ipfilter8.h -> x265_2.4.tar.gz/source/common/x86/ipfilter8.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/x86/loopfilter.asm -> x265_2.4.tar.gz/source/common/x86/loopfilter.asm
Changed
@@ -1,5 +1,5 @@ ;***************************************************************************** -;* Copyright (C) 2013 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Min Chen <chenm001@163.com> ;* Praveen Kumar Tiwari <praveen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/loopfilter.h -> x265_2.4.tar.gz/source/common/x86/loopfilter.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com> * Praveen Kumar Tiwari <praveen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/mc-a.asm -> x265_2.4.tar.gz/source/common/x86/mc-a.asm
Changed
@@ -2,7 +2,7 @@ ;* mc-a.asm: x86 motion compensation ;***************************************************************************** ;* Copyright (C) 2003-2013 x264 project -;* Copyright (C) 2013-2015 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Fiona Glaser <fiona@x264.com>
View file
x265_2.3.tar.gz/source/common/x86/mc-a2.asm -> x265_2.4.tar.gz/source/common/x86/mc-a2.asm
Changed
@@ -1,8 +1,8 @@ ;***************************************************************************** ;* mc-a2.asm: x86 motion compensation ;***************************************************************************** -;* Copyright (C) 2005-2013 x264 project -;* Copyright (C) 2013-2015 x265 project +;* Copyright (C) 2003-2013 x264 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Fiona Glaser <fiona@x264.com>
View file
x265_2.3.tar.gz/source/common/x86/mc.h -> x265_2.4.tar.gz/source/common/x86/mc.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/common/x86/pixel-32.asm -> x265_2.4.tar.gz/source/common/x86/pixel-32.asm
Changed
@@ -2,6 +2,7 @@ ;* pixel-32.asm: x86_32 pixel metrics ;***************************************************************************** ;* Copyright (C) 2003-2013 x264 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Laurent Aimar <fenrir@via.ecp.fr>
View file
x265_2.3.tar.gz/source/common/x86/pixel-a.asm -> x265_2.4.tar.gz/source/common/x86/pixel-a.asm
Changed
@@ -2,7 +2,7 @@ ;* pixel.asm: x86 pixel metrics ;***************************************************************************** ;* Copyright (C) 2003-2013 x264 project -;* Copyright (C) 2013-2015 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Holger Lubitz <holger@lubitz.org>
View file
x265_2.3.tar.gz/source/common/x86/pixel-util.h -> x265_2.4.tar.gz/source/common/x86/pixel-util.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> ;* Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/x86/pixel-util8.asm -> x265_2.4.tar.gz/source/common/x86/pixel-util8.asm
Changed
@@ -1,5 +1,5 @@ ;***************************************************************************** -;* Copyright (C) 2013 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com> ;* Nabajit Deka <nabajit@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/common/x86/pixel.h -> x265_2.4.tar.gz/source/common/x86/pixel.h
Changed
@@ -2,7 +2,7 @@ * pixel.h: x86 pixel metrics ***************************************************************************** * Copyright (C) 2003-2013 x264 project - * Copyright (C) 2013-2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Laurent Aimar <fenrir@via.ecp.fr> * Loren Merritt <lorenm@u.washington.edu>
View file
x265_2.3.tar.gz/source/common/x86/pixeladd8.asm -> x265_2.4.tar.gz/source/common/x86/pixeladd8.asm
Changed
@@ -1,5 +1,5 @@ ;***************************************************************************** -;* Copyright (C) 2013 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Praveen Kumar Tiwari <praveen@multicorewareinc.com> ;* Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/x86/sad-a.asm -> x265_2.4.tar.gz/source/common/x86/sad-a.asm
Changed
@@ -2,7 +2,7 @@ ;* sad-a.asm: x86 sad functions ;***************************************************************************** ;* Copyright (C) 2003-2013 x264 project -;* Copyright (C) 2013-2015 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Fiona Glaser <fiona@x264.com>
View file
x265_2.3.tar.gz/source/common/x86/sad16-a.asm -> x265_2.4.tar.gz/source/common/x86/sad16-a.asm
Changed
@@ -1,7 +1,8 @@ ;***************************************************************************** ;* sad16-a.asm: x86 high depth sad functions ;***************************************************************************** -;* Copyright (C) 2010-2013 x264 project +;* Copyright (C) 2003-2013 x264 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Oskar Arvidsson <oskar@irock.se> ;* Henrik Gramner <henrik@gramner.com>
View file
x265_2.3.tar.gz/source/common/x86/ssd-a.asm -> x265_2.4.tar.gz/source/common/x86/ssd-a.asm
Changed
@@ -2,7 +2,7 @@ ;* ssd-a.asm: x86 ssd functions ;***************************************************************************** ;* Copyright (C) 2003-2013 x264 project -;* Copyright (C) 2013-2015 x265 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Fiona Glaser <fiona@x264.com>
View file
x265_2.3.tar.gz/source/common/x86/x86inc.asm -> x265_2.4.tar.gz/source/common/x86/x86inc.asm
Changed
@@ -1,8 +1,8 @@ ;***************************************************************************** ;* x86inc.asm: x264asm abstraction layer ;***************************************************************************** -;* Copyright (C) 2005-2014 x264 project -;* 2013-2014 x265 project +;* Copyright (C) 2003-2013 x264 project +;* Copyright (C) 2013-2017 MulticoreWarae, Inc ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Anton Mitrofanov <BugMaster@narod.ru>
View file
x265_2.3.tar.gz/source/common/x86/x86util.asm -> x265_2.4.tar.gz/source/common/x86/x86util.asm
Changed
@@ -1,7 +1,8 @@ ;***************************************************************************** ;* x86util.asm: x86 utility macros ;***************************************************************************** -;* Copyright (C) 2008-2013 x264 project +;* Copyright (C) 2003-2013 x264 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Holger Lubitz <holger@lubitz.org> ;* Loren Merritt <lorenm@u.washington.edu>
View file
x265_2.3.tar.gz/source/common/yuv.cpp -> x265_2.4.tar.gz/source/common/yuv.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/common/yuv.h -> x265_2.4.tar.gz/source/common/yuv.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.4.tar.gz/source/dynamicHDR10/BasicStructures.cpp
Added
@@ -0,0 +1,40 @@ +/** + * @file BasicStructures.cpp + * @brief Defines the structure of metadata parameters + * @author Daniel Maximiliano Valenzuela, Seongnam Oh. + * @create date 03/01/2017 + * @version 0.0.1 + * + * Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. +**/ + +#include "BasicStructures.h" +#include "vector" + +struct PercentileLuminance{ + + float averageLuminance = 0.0; + float maxRLuminance = 0.0; + float maxGLuminance = 0.0; + float maxBLuminance = 0.0; + int order; + std::vector<unsigned int> percentiles; +}; + + +
View file
x265_2.4.tar.gz/source/dynamicHDR10/BasicStructures.h
Added
@@ -0,0 +1,50 @@ +/** + * @file BasicStructures.h + * @brief Defines the structure of metadata parameters + * @author Daniel Maximiliano Valenzuela, Seongnam Oh. + * @create date 03/01/2017 + * @version 0.0.1 + * + * Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. +**/ + +#ifndef BASICSTRUCTURES_H +#define BASICSTRUCTURES_H + +#include <vector> + + +struct LuminanceParameters +{ + float averageLuminance = 0.0; + float maxRLuminance = 0.0; + float maxGLuminance = 0.0; + float maxBLuminance = 0.0; + int order; + std::vector<unsigned int> percentiles; +}; + +struct BezierCurveData +{ + int order; + int sPx; + int sPy; + std::vector<int> coeff; +}; + +#endif // BASICSTRUCTURES_H
View file
x265_2.4.tar.gz/source/dynamicHDR10/CMakeLists.txt
Added
@@ -0,0 +1,175 @@ +# vim: syntax=cmake +if(ENABLE_DYNAMIC_HDR10) + +add_library(dynamicHDR10 OBJECT + BasicStructures.cpp BasicStructures.h + json11/json11.cpp json11/json11.h + JsonHelper.cpp JsonHelper.h + metadataFromJson.cpp metadataFromJson.h + SeiMetadataDictionary.cpp SeiMetadataDictionary.h + hdr10plus.h + api.cpp ) + +else() +cmake_minimum_required (VERSION 2.8.11) +project(dynamicHDR10) +include(CheckIncludeFiles) +include(CheckFunctionExists) +include(CheckSymbolExists) +include(CheckCXXCompilerFlag) + +SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}") + +if(GCC) + add_definitions(-Wall -Wextra -Wshadow) + add_definitions(-D__STDC_LIMIT_MACROS=1) + add_definitions(-std=c++11) + if(ENABLE_PIC) + add_definitions(-fPIC) + endif(ENABLE_PIC) + if(NATIVE_BUILD) + if(INTEL_CXX) + add_definitions(-xhost) + else() + add_definitions(-march=native) + endif() + elseif(X86 AND NOT X64) + string(FIND "${CMAKE_CXX_FLAGS}" "-march" marchPos) + if(marchPos LESS "0") + add_definitions(-march=i686) + if(WIN32 AND NOT INTEL_CXX AND NOT CLANG AND + CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) + add_definitions(-mpreferred-stack-boundary=2) + endif() + endif() + endif() + if(ARM AND CROSS_COMPILE_ARM) + set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC) + elseif(ARM) + find_package(Neon) + if(CPU_HAS_NEON) + set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC) + add_definitions(-DHAVE_NEON) + else() + set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm) + endif() + endif() + add_definitions(${ARM_ARGS}) + if(FPROFILE_GENERATE) + if(INTEL_CXX) + add_definitions(-prof-gen -prof-dir="${CMAKE_CURRENT_BINARY_DIR}") + list(APPEND LINKER_OPTIONS "-prof-gen") + else() + check_cxx_compiler_flag(-fprofile-generate CC_HAS_PROFILE_GENERATE) + if(CC_HAS_PROFILE_GENERATE) + add_definitions(-fprofile-generate) + list(APPEND LINKER_OPTIONS "-fprofile-generate") + endif(CC_HAS_PROFILE_GENERATE) + endif(INTEL_CXX) + endif(FPROFILE_GENERATE) + if(FPROFILE_USE) + if(INTEL_CXX) + add_definitions(-prof-use -prof-dir="${CMAKE_CURRENT_BINARY_DIR}") + list(APPEND LINKER_OPTIONS "-prof-use") + else() + check_cxx_compiler_flag(-fprofile-use CC_HAS_PROFILE_USE) + check_cxx_compiler_flag(-fprofile-correction CC_HAS_PROFILE_CORRECTION) + check_cxx_compiler_flag(-Wno-error=coverage-mismatch CC_HAS_COVMISMATCH) + if(CC_HAS_PROFILE_USE) + add_definitions(-fprofile-use) + list(APPEND LINKER_OPTIONS "-fprofile-use") + endif(CC_HAS_PROFILE_USE) + if(CC_HAS_PROFILE_CORRECTION) + # auto-correct corrupted counters (happens a lot with x265) + add_definitions(-fprofile-correction) + endif(CC_HAS_PROFILE_CORRECTION) + if(CC_HAS_COVMISMATCH) + # ignore coverage mismatches (also happens a lot) + add_definitions(-Wno-error=coverage-mismatch) + endif(CC_HAS_COVMISMATCH) + endif(INTEL_CXX) + endif(FPROFILE_USE) + if(STATIC_LINK_CRT) + add_definitions(-static) + list(APPEND LINKER_OPTIONS "-static") + endif(STATIC_LINK_CRT) + check_cxx_compiler_flag(-Wno-strict-overflow CC_HAS_NO_STRICT_OVERFLOW) + check_cxx_compiler_flag(-Wno-narrowing CC_HAS_NO_NARROWING) + check_cxx_compiler_flag(-Wno-array-bounds CC_HAS_NO_ARRAY_BOUNDS) + if (CC_HAS_NO_ARRAY_BOUNDS) + add_definitions(-Wno-array-bounds) # these are unhelpful + endif() + check_cxx_compiler_flag(-ffast-math CC_HAS_FAST_MATH) + if (CC_HAS_FAST_MATH) + add_definitions(-ffast-math) + endif() + check_cxx_compiler_flag(-mstackrealign CC_HAS_STACK_REALIGN) + if (CC_HAS_STACK_REALIGN) + add_definitions(-mstackrealign) + endif() + # Disable exceptions. Reduce executable size, increase compability. + check_cxx_compiler_flag(-fno-exceptions CC_HAS_FNO_EXCEPTIONS_FLAG) + if(CC_HAS_FNO_EXCEPTIONS_FLAG) + add_definitions(-fno-exceptions) + endif() + set(FSANITIZE "" CACHE STRING "-fsanitize options for GCC/clang") + if(FSANITIZE) + add_definitions(-fsanitize=${FSANITIZE}) + # clang and gcc need the sanitize options to be passed at link + # time so the appropriate ASAN/TSAN runtime libraries can be + # linked. + list(APPEND LINKER_OPTIONS "-fsanitize=${FSANITIZE}") + endif() + option(ENABLE_AGGRESSIVE_CHECKS "Enable stack protection and -ftrapv" OFF) + if(ENABLE_AGGRESSIVE_CHECKS) + # use with care, -ftrapv can cause testbench SIGILL exceptions + # since it is testing corner cases of signed integer math + add_definitions(-DUSING_FTRAPV=1) + check_cxx_compiler_flag(-fsanitize=undefined-trap CC_HAS_CATCH_UNDEFINED) # clang + check_cxx_compiler_flag(-ftrapv CC_HAS_FTRAPV) # gcc + check_cxx_compiler_flag(-fstack-protector-all CC_HAS_STACK_PROTECT) # gcc + if(CC_HAS_FTRAPV) + add_definitions(-ftrapv) + endif() + if(CC_HAS_CATCH_UNDEFINED) + add_definitions(-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error) + endif() + if(CC_HAS_STACK_PROTECT) + add_definitions(-fstack-protector-all) + if(MINGW) + list(APPEND PLATFORM_LIBS ssp) + endif() + endif() + endif(ENABLE_AGGRESSIVE_CHECKS) + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CC_VERSION) +endif(GCC) + +# Build options +set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries") +set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables") + +option(ENABLE_SHARED "Build shared library" OFF) + +if(ENABLE_SHARED) + add_library(dynamicHDR10 SHARED + json11/json11.cpp json11/json11.h + BasicStructures.cpp BasicStructures.h + JsonHelper.cpp JsonHelper.h + metadataFromJson.cpp metadataFromJson.h + SeiMetadataDictionary.cpp SeiMetadataDictionary.h + hdr10plus.h api.cpp ) +else() + add_library(dynamicHDR10 STATIC + json11/json11.cpp json11/json11.h + BasicStructures.cpp BasicStructures.h + JsonHelper.cpp JsonHelper.h + metadataFromJson.cpp metadataFromJson.h + SeiMetadataDictionary.cpp SeiMetadataDictionary.h + hdr10plus.h api.cpp ) +endif() + +install (TARGETS dynamicHDR10 + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) +install(FILES hdr10plus.h DESTINATION include) +endif() \ No newline at end of file
View file
x265_2.4.tar.gz/source/dynamicHDR10/JsonHelper.cpp
Added
@@ -0,0 +1,221 @@ +/** + * @file JsonHelper.cpp + * @brief Helper class for JSON parsing + * @author Daniel Maximiliano Valenzuela, Seongnam Oh. + * @create date 03/01/2017 + * @version 0.0.1 + * + * Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. +**/ + +#include "JsonHelper.h" +#include "sys/stat.h" +#include <fstream> +#include <iostream> +using namespace std; + +JsonObject JsonHelper::add(string key, string value, JsonObject &json) +{ + + json[key] = value; + return json; +} + +bool JsonHelper::writeJson(JsonObject json, string path) +{ + if(!validatePathExtension(path)) + { + return false; + } + + ofstream JsonSaveFile(path); + string jsonString; + jsonString = dump(json); + JsonSaveFile << jsonString; + JsonSaveFile.close(); + return true; +} + +bool JsonHelper::writeJson(JsonArray json, string path) +{ + if(!validatePathExtension(path)) + { + return false; + } + + string arrayString = "["; + size_t jsonSize = json.size(); + for(size_t i = 0; i < jsonSize; ++i) + { + arrayString += "\n" + dump(json.at(i).object_items(), 1); + if(i != jsonSize - 1) + { + arrayString += ","; + } + } + arrayString += "\n]"; + + ofstream JsonSaveFile(path); + JsonSaveFile << arrayString; + JsonSaveFile.close(); + return true; +} + +string JsonHelper::dump(JsonObject json, int extraTab) +{ + string dump = Json(json).dump(); + //[defensive programming] possibly check if dump returns a invalid string + string out = ""; + unsigned int tabCounter = extraTab; + printTabs(out,tabCounter); + for(unsigned int i = 0; i < dump.size(); ++i) + { + if(dump[i] == '{' || dump[i] == '[') + { + out += dump[i]; + out += '\n'; + ++tabCounter; + printTabs(out, tabCounter); + } + else if(dump[i] == '}' || dump[i] == ']') + { + out += '\n'; + --tabCounter; + printTabs(out, tabCounter); + out += dump[i]; + } + else if(dump[i] == ',') + { + out += dump[i]; + out += '\n'; + printTabs(out, tabCounter); + ++i; //skip blank space following comma + } + else + { + out += dump[i]; + } + } + return out; +} + +void JsonHelper::printTabs(string &out, int tabCounter) +{ + for(int i = 0; i < tabCounter; ++i) + { + out += '\t'; + } +} + +JsonObject JsonHelper::readJson(string path) +{ + std::size_t ext = path.find_last_of('.'); + std::string extension = path.substr(ext+1); + + if(extension.compare("json") && extension.compare("JSON")) + { + std::cout << "Fail open file, extension not valid!" << std::endl; + return JsonObject(); + } + + struct stat buffer; + if(stat(path.c_str(),&buffer)) + { + std::cout << "Fail open file, file doesn't exist" << std::endl; + return JsonObject(); + } + + ifstream tfile; + string json_str; + string json_str2; + string err = ""; + tfile.open(path); + while(tfile) + { + std::getline(tfile, json_str); + json_str2.append(json_str); + } + + tfile.close(); + size_t beginning = json_str2.find_first_of("{"); + int fixchar = json_str2[json_str2.size() - 2] == '}' ? 1 : 0; + return Json::parse(json_str2.substr(beginning,json_str2.size() - fixchar),err).object_items(); +} + +JsonArray JsonHelper::readJsonArray(const string &path) +{ + std::size_t ext = path.find_last_of('.'); + std::string extension = path.substr(ext+1); + + if(extension.compare("json") && extension.compare("JSON")) + { + std::cout << "Fail open file, extension not valid!" << std::endl; + return JsonArray(); + } + + struct stat buffer; + if(stat(path.c_str(),&buffer)) + { + std::cout << "Fail open file, file doesn't exist" << std::endl; + return JsonArray(); + } + + ifstream tfile; + string json_str; + string json_str2; + string err = ""; + tfile.open(path); + while(tfile) + { + std::getline(tfile, json_str); + json_str2.append(json_str); + } + + tfile.close(); + + size_t beginning = json_str2.find_first_of("["); + int fixchar = json_str2[json_str2.size() - 2] == ']' ? 1 : 0; + return Json::parse(json_str2.substr(beginning,json_str2.size() - fixchar),err).array_items(); +} + +bool JsonHelper::validatePathExtension(string &path) +{ + + if(path.empty()) + { + std::cout << "Fail saving json file" << std::endl; + return false; + } + std::size_t ext = path.find_last_of('.'); + std::string realFilePath = path; + if(ext == std::string::npos) + { + realFilePath += ".json"; + } + else + { + std::string extension = path.substr(ext+1); + if(extension.compare("json") && extension.compare("JSON")) + { + std::cout << "Fail saving file, extension not valid!" << std::endl; + return false; + } + } + path = realFilePath; + return true; +}
View file
x265_2.4.tar.gz/source/dynamicHDR10/JsonHelper.h
Added
@@ -0,0 +1,54 @@ +/** + * @file JsonHelper.h + * @brief Helper class for JSON parsing + * @author Daniel Maximiliano Valenzuela, Seongnam Oh. + * @create date 03/01/2017 + * @version 0.0.1 + * + * Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. +**/ + +#ifndef JSON_H +#define JSON_H +#include <string> +#include <iostream> +#include "json11/json11.h" + +using std::string; +using namespace json11; +typedef Json::object JsonObject; +typedef Json::array JsonArray; + +class JsonHelper +{ +public: + static JsonObject readJson(string path); + static JsonArray readJsonArray(const string &path); + static string dump(JsonArray json); + static string dump(JsonObject json, int extraTab = 0); + + static bool writeJson(JsonObject json , string path); + static bool writeJson(JsonArray json, string path); + static JsonObject add(string key, string value, JsonObject &json); +private: + static void printTabs(string &out, int tabCounter); + JsonObject mJson; + static bool validatePathExtension(string &path); +}; + +#endif // JSON_H
View file
x265_2.4.tar.gz/source/dynamicHDR10/LICENSE.txt
Added
@@ -0,0 +1,20 @@ +Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + +This software is the confidential and proprietary information of Samsung Electronics, Inc. ("Confidential Information"). +You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement +you entered into with Samsung. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +MA 02110-1301, USA. \ No newline at end of file
View file
x265_2.4.tar.gz/source/dynamicHDR10/SeiMetadataDictionary.cpp
Added
@@ -0,0 +1,113 @@ +/** + * @file SeiMetadataDictionary.cpp + * @brief Defines the tagname for each metadata value in a JSON dynamic tone mapping file. + * @author Daniel Maximiliano Valenzuela, Seongnam Oh. + * @create date 03/01/2017 + * @version 0.0.1 + * + * Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. +**/ + +#include "SeiMetadataDictionary.h" + +using namespace SeiMetadataDictionary; + +const std::string JsonDataKeys::LocalParameters = std::string("LocalParameters"); +const std::string JsonDataKeys::TargetDisplayLuminance = std::string("TargetedSystemDisplayMaximumLuminance"); + +const std::string BezierCurveNames::TagName = std::string("BezierCurveData"); +const std::string BezierCurveNames::NumberOfAnchors = std::string("NumberOfAnchors"); +const std::string BezierCurveNames::KneePointX = std::string("KneePointX"); +const std::string BezierCurveNames::KneePointY = std::string("KneePointY"); +const std::string BezierCurveNames::Anchors[] = {std::string("Anchor0"), + std::string("Anchor1"), + std::string("Anchor2"), + std::string("Anchor3"), + std::string("Anchor4"), + std::string("Anchor5"), + std::string("Anchor6"), + std::string("Anchor7"), + std::string("Anchor8"), + std::string("Anchor9"), + std::string("Anchor10"), + std::string("Anchor11"), + std::string("Anchor12"), + std::string("Anchor13")}; + + +const std::string EllipseSelectionNames::WindowUpperLeftCornerX = std::string("WindowUpperLeftCornerX"); +const std::string EllipseSelectionNames::WindowUpperLeftCornerY = std::string("WindowUpperLeftCornerY"); +const std::string EllipseSelectionNames::WindowLowerRightCornerX = std::string("WindowLowerRightCornerX"); +const std::string EllipseSelectionNames::WindowLowerRightCornerY = std::string("WindowLowerRightCornerY"); +const std::string EllipseSelectionNames::WindowData = std::string("WindowData"); + + +const std::string EllipseNames::TagName = std::string("EllipseData"); +const std::string EllipseNames::RotationAngle = std::string("RotationAngle"); +const std::string EllipseNames::CenterOfEllipseX = std::string("CenterOfEllipseX"); +const std::string EllipseNames::CenterOfEllipseY = std::string("CenterOfEllipseY"); +const std::string EllipseNames::OverlapProcessOption = std::string("OverlapProcessOption"); +const std::string EllipseNames::SemiMajorAxisExternalEllipse = std::string("SemimajorAxisExternalEllipse"); +const std::string EllipseNames::SemiMinorAxisExternalEllipse = std::string("SemiminorAxisExternalEllipse"); +const std::string EllipseNames::SemiMajorAxisInternalEllipse = std::string("SemimajorAxisInternalEllipse"); + + +const std::string PercentileNames::TagName = std::string("PercentileLuminance"); +const std::string PercentileNames::NumberOfPercentiles = std::string("NumberOfPercentiles"); +const std::string PercentileNames::PercentilePercentageValue[] = {std::string("PercentilePercentage0"), + std::string("PercentilePercentage1"), + std::string("PercentilePercentage2"), + std::string("PercentilePercentage3"), + std::string("PercentilePercentage4"), + std::string("PercentilePercentage5"), + std::string("PercentilePercentage6"), + std::string("PercentilePercentage7"), + std::string("PercentilePercentage8"), + std::string("PercentilePercentage9"), + std::string("PercentilePercentage10"), + std::string("PercentilePercentage11"), + std::string("PercentilePercentage12"), + std::string("PercentilePercentage13"), + std::string("PercentilePercentage14")}; + +const std::string PercentileNames::PercentileLuminanceValue[] = {std::string("PercentileLuminance0"), + std::string("PercentileLuminance1"), + std::string("PercentileLuminance2"), + std::string("PercentileLuminance3"), + std::string("PercentileLuminance4"), + std::string("PercentileLuminance5"), + std::string("PercentileLuminance6"), + std::string("PercentileLuminance7"), + std::string("PercentileLuminance8"), + std::string("PercentileLuminance9"), + std::string("PercentileLuminance10"), + std::string("PercentileLuminance11"), + std::string("PercentileLuminance12"), + std::string("PercentileLuminance13"), + std::string("PercentileLuminance14")}; + + + +const std::string LuminanceNames::TagName = std::string("LuminanceParameters"); +const std::string LuminanceNames::AverageRGB = std::string("AverageRGB"); +const std::string LuminanceNames::MaxSCL0 = std::string("MaxScl0"); +const std::string LuminanceNames::MaxSCL1 = std::string("MaxScl1"); +const std::string LuminanceNames::MaxSCL2 = std::string("MaxScl2"); + + +
View file
x265_2.4.tar.gz/source/dynamicHDR10/SeiMetadataDictionary.h
Added
@@ -0,0 +1,97 @@ +/** + * @file SeiMetadataDictionary.h + * @brief Defines the tagname for each metadata value in a JSON dynamic tone mapping file. + * @author Daniel Maximiliano Valenzuela, Seongnam Oh. + * @create date 03/01/2017 + * @version 0.0.1 + * + * Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. +**/ + +#ifndef SEIMETADATADICTIONARY_H +#define SEIMETADATADICTIONARY_H + +#include "SeiMetadataDictionary.h" + +#include <string> + +namespace SeiMetadataDictionary +{ + + class JsonDataKeys + { + public: + static const std::string LocalParameters; + static const std::string TargetDisplayLuminance; + }; + + //Bezier Curve Data + class BezierCurveNames + { + public: + static const std::string TagName; + static const std::string NumberOfAnchors; + static const std::string KneePointX; + static const std::string KneePointY; + static const std::string Anchors[14]; + }; + //Ellipse Selection Data + class EllipseSelectionNames + { + public: + static const std::string WindowUpperLeftCornerX; + static const std::string WindowUpperLeftCornerY; + static const std::string WindowLowerRightCornerX; + static const std::string WindowLowerRightCornerY; + static const std::string WindowData; + }; + //Ellipse Data + class EllipseNames + { + public: + static const std::string TagName; + static const std::string RotationAngle; + static const std::string CenterOfEllipseX; + static const std::string CenterOfEllipseY; + static const std::string OverlapProcessOption; + static const std::string SemiMajorAxisExternalEllipse; + static const std::string SemiMinorAxisExternalEllipse; + static const std::string SemiMajorAxisInternalEllipse; + }; + //Percentile Luminance + class PercentileNames + { + public: + static const std::string TagName; + static const std::string NumberOfPercentiles; + static const std::string PercentilePercentageValue[15]; + static const std::string PercentileLuminanceValue[15]; + }; + //Luminance Parameters + class LuminanceNames + { + public: + static const std::string TagName; + static const std::string AverageRGB; + static const std::string MaxSCL0; + static const std::string MaxSCL1; + static const std::string MaxSCL2; + }; +} + +#endif // SEIMETADATADICTIONARY_H
View file
x265_2.4.tar.gz/source/dynamicHDR10/api.cpp
Added
@@ -0,0 +1,79 @@ +/** + * @file api.cpp + * @brief Implementation of hdr10plus API functions. + * @author Daniel Maximiliano Valenzuela, Seongnam Oh. + * @create date 03/01/2017 + * @version 0.0.1 + * + * Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. +**/ + +#include "hdr10plus.h" +#include "metadataFromJson.h" + +bool hdr10plus_json_to_frame_cim(const char* path, uint32_t frameNumber, uint8_t *&cim) +{ + metadataFromJson meta; + return meta.frameMetadataFromJson(path, + frameNumber, + cim); +} + +int hdr10plus_json_to_movie_cim(const char* path, uint8_t **&cim) +{ + metadataFromJson meta; + return meta.movieMetadataFromJson(path, cim); +} + +bool hdr10plus_json_to_frame_eif(const char* path, uint32_t frameNumber, uint8_t *&eif) +{ + metadataFromJson meta; + return meta.extendedInfoFrameMetadataFromJson(path, + frameNumber, + eif); +} + +int hdr10plus_json_to_movie_eif(const char* path, uint8_t **&eif) +{ + metadataFromJson meta; + return meta.movieExtendedInfoFrameMetadataFromJson(path, eif); +} + + +void hdr10plus_clear_movie(uint8_t **&metadata, const int numberOfFrames) +{ + if(metadata) + { + metadataFromJson meta; + meta.clear(metadata, numberOfFrames); + } +} + +static const hdr10plus_api libapi = +{ + &hdr10plus_json_to_frame_cim, + &hdr10plus_json_to_movie_cim, + &hdr10plus_json_to_frame_eif, + &hdr10plus_json_to_movie_eif, + &hdr10plus_clear_movie, +}; + +const hdr10plus_api* hdr10plus_api_get() +{ + return &libapi; +}
View file
x265_2.4.tar.gz/source/dynamicHDR10/hdr10plus.h
Added
@@ -0,0 +1,101 @@ +/** + * @file hdr10plus.h + * @brief Definition of hdr10plus functions. + * @author Daniel Maximiliano Valenzuela, Seongnam Oh. + * @create date 03/01/2017 + * @version 0.0.1 + * + * Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. +**/ + +#include <stdint.h> + +#ifndef HDR10PLUS_H +#define HDR10PLUS_H + + +/* hdr10plus_json_to_frame_cim: + * Parses the json file containing the Creative Intent Metadata DTM for a frame of + * video into a bytestream to be encoded into the resulting video stream. + * path is the file path of the JSON file containing the DTM for the video. + * frameNumber is the number of the frame to get the metadata for. + * cim will get filled with the byte array containing the actual metadata. + * Returns true in case of success. + */ +bool hdr10plus_json_to_frame_cim(const char* path, uint32_t frameNumber, uint8_t *&cim); + +/* hdr10plus_json_to_movie_cim: + * Parses the json file containing the Creative Intent Metadata DTM for the video + * into a bytestream to be encoded into the resulting video stream. + * path is the file path of the JSON file containing the DTM for the video. + * frameNumber is the number of the frame to get the metadata for. + * cim will get filled with the byte array containing the actual metadata. + * return int: number of frames in the movie, -1 if the process fails to obtain the metadata. + */ +int hdr10plus_json_to_movie_cim(const char* path, uint8_t **&cim); + +/* hdr10plus_json_to_frame_eif: +* Parses the json file containing the Extended InfoFrame metadata for a frame of video +* into a bytestream to be encoded into the resulting video stream. +* path is the file path of the JSON file containing the Extended InfoFrame metadata for the video. +* frameNumber is the number of the frame to get the metadata for. +* Extended InfoFrame will get filled with the byte array containing the actual metadata. +* Returns true in case of success. +*/ +bool hdr10plus_json_to_frame_eif(const char* path, uint32_t frameNumber, uint8_t *&eif); + +/* hdr10plus_json_to_movie_eif: +* Parses the json file containing the Extended InfoFrame metadata for the video +* into a bytestream to be encoded into the resulting video stream. +* path is the file path of the JSON file containing the Extended InfoFrame metadata for the video. +* frameNumber is the number of the frame to get the metadata for. +* cim will get filled with the byte array containing the actual metadata. +* return int: number of frames in the movie, -1 if the process fails to obtain the metadata. +*/ +int hdr10plus_json_to_movie_eif(const char* path, uint8_t **&eif); + + +/* hdr10plus_clear_movie_cim: +* This function clears the allocated memory for the movie metadata array +* clear: Clears the memory of the given array and size. +* metadata: metadata array to be cleared. +* numberOfFrames: number of frames in the metadata array. +* @return +*/ + +void hdr10plus_clear_movie(uint8_t**& metadata, const int numberOfFrames); + + +typedef struct hdr10plus_api +{ + /* hdr10plus public API functions, documented above with hdr10plus_ prefixes */ + bool (*hdr10plus_json_to_frame_cim)(const char *, uint32_t, uint8_t *&); + int (*hdr10plus_json_to_movie_cim)(const char *, uint8_t **&); + bool (*hdr10plus_json_to_frame_eif)(const char *, uint32_t, uint8_t *&); + int (*hdr10plus_json_to_movie_eif)(const char *, uint8_t **&); + void (*hdr10plus_clear_movie)(uint8_t **&, const int); +} hdr10plus_api; + +/* hdr10plus_api: + * Retrieve the programming interface for the linked hdr10plus library. + */ +const hdr10plus_api* hdr10plus_api_get(); + + +#endif // HDR10PLUS_H +
View file
x265_2.4.tar.gz/source/dynamicHDR10/json11/LICENSE.txt
Added
@@ -0,0 +1,19 @@ +Copyright (c) 2013 Dropbox, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.
View file
x265_2.4.tar.gz/source/dynamicHDR10/json11/json11.cpp
Added
@@ -0,0 +1,780 @@ +/* Copyright (c) 2013 Dropbox, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "json11.h" +#include <cassert> +#include <cmath> +#include <cstdlib> +#include <cstdio> +#include <limits> + +namespace json11 { + +static const int max_depth = 200; + +using std::string; +using std::vector; +using std::map; +using std::make_shared; +using std::initializer_list; +using std::move; + +/* * * * * * * * * * * * * * * * * * * * + * Serialization + */ + +static void dump(std::nullptr_t, string &out) { + out += "null"; +} + +static void dump(double value, string &out) { + if (std::isfinite(value)) { + char buf[32]; + snprintf(buf, sizeof buf, "%.17g", value); + out += buf; + } else { + out += "null"; + } +} + +static void dump(int value, string &out) { + char buf[32]; + snprintf(buf, sizeof buf, "%d", value); + out += buf; +} + +static void dump(bool value, string &out) { + out += value ? "true" : "false"; +} + +static void dump(const string &value, string &out) { + out += '"'; + for (size_t i = 0; i < value.length(); i++) { + const char ch = value[i]; + if (ch == '\\') { + out += "\\\\"; + } else if (ch == '"') { + out += "\\\""; + } else if (ch == '\b') { + out += "\\b"; + } else if (ch == '\f') { + out += "\\f"; + } else if (ch == '\n') { + out += "\\n"; + } else if (ch == '\r') { + out += "\\r"; + } else if (ch == '\t') { + out += "\\t"; + } else if (static_cast<uint8_t>(ch) <= 0x1f) { + char buf[8]; + snprintf(buf, sizeof buf, "\\u%04x", ch); + out += buf; + } else if (static_cast<uint8_t>(ch) == 0xe2 && static_cast<uint8_t>(value[i+1]) == 0x80 + && static_cast<uint8_t>(value[i+2]) == 0xa8) { + out += "\\u2028"; + i += 2; + } else if (static_cast<uint8_t>(ch) == 0xe2 && static_cast<uint8_t>(value[i+1]) == 0x80 + && static_cast<uint8_t>(value[i+2]) == 0xa9) { + out += "\\u2029"; + i += 2; + } else { + out += ch; + } + } + out += '"'; +} + +static void dump(const Json::array &values, string &out) { + bool first = true; + out += "["; + for (const auto &value : values) { + if (!first) + out += ", "; + value.dump(out); + first = false; + } + out += "]"; +} + +static void dump(const Json::object &values, string &out) { + bool first = true; + out += "{"; + for (const auto &kv : values) { + if (!first) + out += ", "; + dump(kv.first, out); + out += ": "; + kv.second.dump(out); + first = false; + } + out += "}"; +} + +void Json::dump(string &out) const { + m_ptr->dump(out); +} + +/* * * * * * * * * * * * * * * * * * * * + * Value wrappers + */ + +template <Json::Type tag, typename T> +class Value : public JsonValue { +protected: + + // Constructors + explicit Value(const T &value) : m_value(value) {} + explicit Value(T &&value) : m_value(move(value)) {} + + // Get type tag + Json::Type type() const override { + return tag; + } + + // Comparisons + bool equals(const JsonValue * other) const override { + return m_value == static_cast<const Value<tag, T> *>(other)->m_value; + } + bool less(const JsonValue * other) const override { + return m_value < static_cast<const Value<tag, T> *>(other)->m_value; + } + + const T m_value; + void dump(string &out) const override { json11::dump(m_value, out); } +}; + +class JsonDouble final : public Value<Json::NUMBER, double> { + double number_value() const override { return m_value; } + int int_value() const override { return static_cast<int>(m_value); } + bool equals(const JsonValue * other) const override { return m_value == other->number_value(); } + bool less(const JsonValue * other) const override { return m_value < other->number_value(); } +public: + explicit JsonDouble(double value) : Value(value) {} +}; + +class JsonInt final : public Value<Json::NUMBER, int> { + double number_value() const override { return m_value; } + int int_value() const override { return m_value; } + bool equals(const JsonValue * other) const override { return m_value == other->number_value(); } + bool less(const JsonValue * other) const override { return m_value < other->number_value(); } +public: + explicit JsonInt(int value) : Value(value) {} +}; + +class JsonBoolean final : public Value<Json::BOOL, bool> { + bool bool_value() const override { return m_value; } +public: + explicit JsonBoolean(bool value) : Value(value) {} +}; + +class JsonString final : public Value<Json::STRING, string> { + const string &string_value() const override { return m_value; } +public: + explicit JsonString(const string &value) : Value(value) {} + explicit JsonString(string &&value) : Value(move(value)) {} +}; + +class JsonArray final : public Value<Json::ARRAY, Json::array> { + const Json::array &array_items() const override { return m_value; } + const Json & operator[](size_t i) const override; +public: + explicit JsonArray(const Json::array &value) : Value(value) {} + explicit JsonArray(Json::array &&value) : Value(move(value)) {} +}; + +class JsonObject final : public Value<Json::OBJECT, Json::object> { + const Json::object &object_items() const override { return m_value; } + const Json & operator[](const string &key) const override; +public: + explicit JsonObject(const Json::object &value) : Value(value) {} + explicit JsonObject(Json::object &&value) : Value(move(value)) {} +}; + +class JsonNull final : public Value<Json::NUL, std::nullptr_t> { +public: + JsonNull() : Value(nullptr) {} +}; + +/* * * * * * * * * * * * * * * * * * * * + * Static globals - static-init-safe + */ +struct Statics { + const std::shared_ptr<JsonValue> null = make_shared<JsonNull>(); + const std::shared_ptr<JsonValue> t = make_shared<JsonBoolean>(true); + const std::shared_ptr<JsonValue> f = make_shared<JsonBoolean>(false); + const string empty_string; + const vector<Json> empty_vector; + const map<string, Json> empty_map; + Statics() {} +}; + +static const Statics & statics() { + static const Statics s {}; + return s; +} + +static const Json & static_null() { + // This has to be separate, not in Statics, because Json() accesses statics().null. + static const Json json_null; + return json_null; +} + +/* * * * * * * * * * * * * * * * * * * * + * Constructors + */ + +Json::Json() noexcept : m_ptr(statics().null) {} +Json::Json(std::nullptr_t) noexcept : m_ptr(statics().null) {} +Json::Json(double value) : m_ptr(make_shared<JsonDouble>(value)) {} +Json::Json(int value) : m_ptr(make_shared<JsonInt>(value)) {} +Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {} +Json::Json(const string &value) : m_ptr(make_shared<JsonString>(value)) {} +Json::Json(string &&value) : m_ptr(make_shared<JsonString>(move(value))) {} +Json::Json(const char * value) : m_ptr(make_shared<JsonString>(value)) {} +Json::Json(const Json::array &values) : m_ptr(make_shared<JsonArray>(values)) {} +Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(move(values))) {} +Json::Json(const Json::object &values) : m_ptr(make_shared<JsonObject>(values)) {} +Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(move(values))) {} + +/* * * * * * * * * * * * * * * * * * * * + * Accessors + */ + +Json::Type Json::type() const { return m_ptr->type(); } +double Json::number_value() const { return m_ptr->number_value(); } +int Json::int_value() const { return m_ptr->int_value(); } +bool Json::bool_value() const { return m_ptr->bool_value(); } +const string & Json::string_value() const { return m_ptr->string_value(); } +const vector<Json> & Json::array_items() const { return m_ptr->array_items(); } +const map<string, Json> & Json::object_items() const { return m_ptr->object_items(); } +const Json & Json::operator[] (size_t i) const { return (*m_ptr)[i]; } +const Json & Json::operator[] (const string &key) const { return (*m_ptr)[key]; } + +double JsonValue::number_value() const { return 0; } +int JsonValue::int_value() const { return 0; } +bool JsonValue::bool_value() const { return false; } +const string & JsonValue::string_value() const { return statics().empty_string; } +const vector<Json> & JsonValue::array_items() const { return statics().empty_vector; } +const map<string, Json> & JsonValue::object_items() const { return statics().empty_map; } +const Json & JsonValue::operator[] (size_t) const { return static_null(); } +const Json & JsonValue::operator[] (const string &) const { return static_null(); } + +const Json & JsonObject::operator[] (const string &key) const { + auto iter = m_value.find(key); + return (iter == m_value.end()) ? static_null() : iter->second; +} +const Json & JsonArray::operator[] (size_t i) const { + if (i >= m_value.size()) return static_null(); + else return m_value[i]; +} + +/* * * * * * * * * * * * * * * * * * * * + * Comparison + */ + +bool Json::operator== (const Json &other) const { + if (m_ptr->type() != other.m_ptr->type()) + return false; + + return m_ptr->equals(other.m_ptr.get()); +} + +bool Json::operator< (const Json &other) const { + if (m_ptr->type() != other.m_ptr->type()) + return m_ptr->type() < other.m_ptr->type(); + + return m_ptr->less(other.m_ptr.get()); +} + +/* * * * * * * * * * * * * * * * * * * * + * Parsing + */ + +/* esc(c) + * + * Format char c suitable for printing in an error message. + */ +static inline string esc(char c) { + char buf[12]; + if (static_cast<uint8_t>(c) >= 0x20 && static_cast<uint8_t>(c) <= 0x7f) { + snprintf(buf, sizeof buf, "'%c' (%d)", c, c); + } else { + snprintf(buf, sizeof buf, "(%d)", c); + } + return string(buf); +} + +static inline bool in_range(long x, long lower, long upper) { + return (x >= lower && x <= upper); +} + +namespace { +/* JsonParser + * + * Object that tracks all state of an in-progress parse. + */ +struct JsonParser final { + + /* State + */ + const string &str; + size_t i; + string &err; + bool failed; + const JsonParse strategy; + + /* fail(msg, err_ret = Json()) + * + * Mark this parse as failed. + */ + Json fail(string &&msg) { + return fail(move(msg), Json()); + } + + template <typename T> + T fail(string &&msg, const T err_ret) { + if (!failed) + err = std::move(msg); + failed = true; + return err_ret; + } + + /* consume_whitespace() + * + * Advance until the current character is non-whitespace. + */ + void consume_whitespace() { + while (str[i] == ' ' || str[i] == '\r' || str[i] == '\n' || str[i] == '\t') + i++; + } + + /* consume_comment() + * + * Advance comments (c-style inline and multiline). + */ + bool consume_comment() { + bool comment_found = false; + if (str[i] == '/') { + i++; + if (i == str.size()) + return fail("unexpected end of input inside comment", false); + if (str[i] == '/') { // inline comment + i++; + if (i == str.size()) + return fail("unexpected end of input inside inline comment", false); + // advance until next line + while (str[i] != '\n') { + i++; + if (i == str.size()) + return fail("unexpected end of input inside inline comment", false); + } + comment_found = true; + } + else if (str[i] == '*') { // multiline comment + i++; + if (i > str.size()-2) + return fail("unexpected end of input inside multi-line comment", false); + // advance until closing tokens + while (!(str[i] == '*' && str[i+1] == '/')) { + i++; + if (i > str.size()-2) + return fail( + "unexpected end of input inside multi-line comment", false); + } + i += 2; + if (i == str.size()) + return fail( + "unexpected end of input inside multi-line comment", false); + comment_found = true; + } + else + return fail("malformed comment", false); + } + return comment_found; + } + + /* consume_garbage() + * + * Advance until the current character is non-whitespace and non-comment. + */ + void consume_garbage() { + consume_whitespace(); + if(strategy == JsonParse::COMMENTS) { + bool comment_found = false; + do { + comment_found = consume_comment(); + consume_whitespace(); + } + while(comment_found); + } + } + + /* get_next_token() + * + * Return the next non-whitespace character. If the end of the input is reached, + * flag an error and return 0. + */ + char get_next_token() { + consume_garbage(); + if (i == str.size()) + return fail("unexpected end of input", 0); + + return str[i++]; + } + + /* encode_utf8(pt, out) + * + * Encode pt as UTF-8 and add it to out. + */ + void encode_utf8(long pt, string & out) { + if (pt < 0) + return; + + if (pt < 0x80) { + out += static_cast<char>(pt); + } else if (pt < 0x800) { + out += static_cast<char>((pt >> 6) | 0xC0); + out += static_cast<char>((pt & 0x3F) | 0x80); + } else if (pt < 0x10000) { + out += static_cast<char>((pt >> 12) | 0xE0); + out += static_cast<char>(((pt >> 6) & 0x3F) | 0x80); + out += static_cast<char>((pt & 0x3F) | 0x80); + } else { + out += static_cast<char>((pt >> 18) | 0xF0); + out += static_cast<char>(((pt >> 12) & 0x3F) | 0x80); + out += static_cast<char>(((pt >> 6) & 0x3F) | 0x80); + out += static_cast<char>((pt & 0x3F) | 0x80); + } + } + + /* parse_string() + * + * Parse a string, starting at the current position. + */ + string parse_string() { + string out; + long last_escaped_codepoint = -1; + while (true) { + if (i == str.size()) + return fail("unexpected end of input in string", ""); + + char ch = str[i++]; + + if (ch == '"') { + encode_utf8(last_escaped_codepoint, out); + return out; + } + + if (in_range(ch, 0, 0x1f)) + return fail("unescaped " + esc(ch) + " in string", ""); + + // The usual case: non-escaped characters + if (ch != '\\') { + encode_utf8(last_escaped_codepoint, out); + last_escaped_codepoint = -1; + out += ch; + continue; + } + + // Handle escapes + if (i == str.size()) + return fail("unexpected end of input in string", ""); + + ch = str[i++]; + + if (ch == 'u') { + // Extract 4-byte escape sequence + string esc = str.substr(i, 4); + // Explicitly check length of the substring. The following loop + // relies on std::string returning the terminating NUL when + // accessing str[length]. Checking here reduces brittleness. + if (esc.length() < 4) { + return fail("bad \\u escape: " + esc, ""); + } + for (int j = 0; j < 4; j++) { + if (!in_range(esc[j], 'a', 'f') && !in_range(esc[j], 'A', 'F') + && !in_range(esc[j], '0', '9')) + return fail("bad \\u escape: " + esc, ""); + } + + long codepoint = strtol(esc.data(), nullptr, 16); + + // JSON specifies that characters outside the BMP shall be encoded as a pair + // of 4-hex-digit \u escapes encoding their surrogate pair components. Check + // whether we're in the middle of such a beast: the previous codepoint was an + // escaped lead (high) surrogate, and this is a trail (low) surrogate. + if (in_range(last_escaped_codepoint, 0xD800, 0xDBFF) + && in_range(codepoint, 0xDC00, 0xDFFF)) { + // Reassemble the two surrogate pairs into one astral-plane character, per + // the UTF-16 algorithm. + encode_utf8((((last_escaped_codepoint - 0xD800) << 10) + | (codepoint - 0xDC00)) + 0x10000, out); + last_escaped_codepoint = -1; + } else { + encode_utf8(last_escaped_codepoint, out); + last_escaped_codepoint = codepoint; + } + + i += 4; + continue; + } + + encode_utf8(last_escaped_codepoint, out); + last_escaped_codepoint = -1; + + if (ch == 'b') { + out += '\b'; + } else if (ch == 'f') { + out += '\f'; + } else if (ch == 'n') { + out += '\n'; + } else if (ch == 'r') { + out += '\r'; + } else if (ch == 't') { + out += '\t'; + } else if (ch == '"' || ch == '\\' || ch == '/') { + out += ch; + } else { + return fail("invalid escape character " + esc(ch), ""); + } + } + } + + /* parse_number() + * + * Parse a double. + */ + Json parse_number() { + size_t start_pos = i; + + if (str[i] == '-') + i++; + + // Integer part + if (str[i] == '0') { + i++; + if (in_range(str[i], '0', '9')) + return fail("leading 0s not permitted in numbers"); + } else if (in_range(str[i], '1', '9')) { + i++; + while (in_range(str[i], '0', '9')) + i++; + } else { + return fail("invalid " + esc(str[i]) + " in number"); + } + + if (str[i] != '.' && str[i] != 'e' && str[i] != 'E' + && (i - start_pos) <= static_cast<size_t>(std::numeric_limits<int>::digits10)) { + return std::atoi(str.c_str() + start_pos); + } + + // Decimal part + if (str[i] == '.') { + i++; + if (!in_range(str[i], '0', '9')) + return fail("at least one digit required in fractional part"); + + while (in_range(str[i], '0', '9')) + i++; + } + + // Exponent part + if (str[i] == 'e' || str[i] == 'E') { + i++; + + if (str[i] == '+' || str[i] == '-') + i++; + + if (!in_range(str[i], '0', '9')) + return fail("at least one digit required in exponent"); + + while (in_range(str[i], '0', '9')) + i++; + } + + return std::strtod(str.c_str() + start_pos, nullptr); + } + + /* expect(str, res) + * + * Expect that 'str' starts at the character that was just read. If it does, advance + * the input and return res. If not, flag an error. + */ + Json expect(const string &expected, Json res) { + assert(i != 0); + i--; + if (str.compare(i, expected.length(), expected) == 0) { + i += expected.length(); + return res; + } else { + return fail("parse error: expected " + expected + ", got " + str.substr(i, expected.length())); + } + } + + /* parse_json() + * + * Parse a JSON object. + */ + Json parse_json(int depth) { + if (depth > max_depth) { + return fail("exceeded maximum nesting depth"); + } + + char ch = get_next_token(); + if (failed) + return Json(); + + if (ch == '-' || (ch >= '0' && ch <= '9')) { + i--; + return parse_number(); + } + + if (ch == 't') + return expect("true", true); + + if (ch == 'f') + return expect("false", false); + + if (ch == 'n') + return expect("null", Json()); + + if (ch == '"') + return parse_string(); + + if (ch == '{') { + map<string, Json> data; + ch = get_next_token(); + if (ch == '}') + return data; + + while (1) { + if (ch != '"') + return fail("expected '\"' in object, got " + esc(ch)); + + string key = parse_string(); + if (failed) + return Json(); + + ch = get_next_token(); + if (ch != ':') + return fail("expected ':' in object, got " + esc(ch)); + + data[std::move(key)] = parse_json(depth + 1); + if (failed) + return Json(); + + ch = get_next_token(); + if (ch == '}') + break; + if (ch != ',') + return fail("expected ',' in object, got " + esc(ch)); + + ch = get_next_token(); + } + return data; + } + + if (ch == '[') { + vector<Json> data; + ch = get_next_token(); + if (ch == ']') + return data; + + while (1) { + i--; + data.push_back(parse_json(depth + 1)); + if (failed) + return Json(); + + ch = get_next_token(); + if (ch == ']') + break; + if (ch != ',') + return fail("expected ',' in list, got " + esc(ch)); + + ch = get_next_token(); + (void)ch; + } + return data; + } + + return fail("expected value, got " + esc(ch)); + } +}; +}//namespace { + +Json Json::parse(const string &in, string &err, JsonParse strategy) { + JsonParser parser { in, 0, err, false, strategy }; + Json result = parser.parse_json(0); + + // Check for any trailing garbage + parser.consume_garbage(); + if (parser.i != in.size()) + return parser.fail("unexpected trailing " + esc(in[parser.i])); + + return result; +} + +// Documented in json11.hpp +vector<Json> Json::parse_multi(const string &in, + std::string::size_type &parser_stop_pos, + string &err, + JsonParse strategy) { + JsonParser parser { in, 0, err, false, strategy }; + parser_stop_pos = 0; + vector<Json> json_vec; + while (parser.i != in.size() && !parser.failed) { + json_vec.push_back(parser.parse_json(0)); + // Check for another object + parser.consume_garbage(); + if (!parser.failed) + parser_stop_pos = parser.i; + } + return json_vec; +} + +/* * * * * * * * * * * * * * * * * * * * + * Shape-checking + */ + +bool Json::has_shape(const shape & types, string & err) const { + if (!is_object()) { + err = "expected JSON object, got " + dump(); + return false; + } + + for (auto & item : types) { + if ((*this)[item.first].type() != item.second) { + err = "bad type for " + item.first + " in " + dump(); + return false; + } + } + + return true; +} +//void Json::add(std::string &key, std::string value) +//{ +// (*m_ptr)[key] = value; +//} + +} // namespace json11 + +
View file
x265_2.4.tar.gz/source/dynamicHDR10/json11/json11.h
Added
@@ -0,0 +1,235 @@ +/* json11 + * + * json11 is a tiny JSON library for C++11, providing JSON parsing and serialization. + * + * The core object provided by the library is json11::Json. A Json object represents any JSON + * value: null, bool, number (int or double), string (std::string), array (std::vector), or + * object (std::map). + * + * Json objects act like values: they can be assigned, copied, moved, compared for equality or + * order, etc. There are also helper methods Json::dump, to serialize a Json to a string, and + * Json::parse (static) to parse a std::string as a Json object. + * + * Internally, the various types of Json object are represented by the JsonValue class + * hierarchy. + * + * A note on numbers - JSON specifies the syntax of number formatting but not its semantics, + * so some JSON implementations distinguish between integers and floating-point numbers, while + * some don't. In json11, we choose the latter. Because some JSON implementations (namely + * Javascript itself) treat all numbers as the same type, distinguishing the two leads + * to JSON that will be *silently* changed by a round-trip through those implementations. + * Dangerous! To avoid that risk, json11 stores all numbers as double internally, but also + * provides integer helpers. + * + * Fortunately, double-precision IEEE754 ('double') can precisely store any integer in the + * range +/-2^53, which includes every 'int' on most systems. (Timestamps often use int64 + * or long long to avoid the Y2038K problem; a double storing microseconds since some epoch + * will be exact for +/- 275 years.) + */ + +/* Copyright (c) 2013 Dropbox, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include <string> +#include <vector> +#include <map> +#include <memory> +#include <initializer_list> + +#ifdef _MSC_VER + #if _MSC_VER <= 1800 // VS 2013 + #ifndef noexcept + #define noexcept throw() + #endif + + #ifndef snprintf + #define snprintf _snprintf_s + #endif + #endif +#endif + +namespace json11 { + +enum JsonParse { + STANDARD, COMMENTS +}; + +class JsonValue; + +class Json final{ //final +public: + // Types + enum Type { + NUL, NUMBER, BOOL, STRING, ARRAY, OBJECT + }; + + // Array and object typedefs + typedef std::vector<Json> array; + typedef std::map<std::string, Json> object; + + // Constructors for the various types of JSON value. + Json() noexcept; // NUL + Json(std::nullptr_t) noexcept; // NUL + Json(double value); // NUMBER + Json(int value); // NUMBER + Json(bool value); // BOOL + Json(const std::string &value); // STRING + Json(std::string &&value); // STRING + Json(const char * value); // STRING + Json(const array &values); // ARRAY + Json(array &&values); // ARRAY + Json(const object &values); // OBJECT + Json(object &&values); // OBJECT + void add(std::string &key, std::string value); + + // Implicit constructor: anything with a to_json() function. + template <class T, class = decltype(&T::to_json)> + Json(const T & t) : Json(t.to_json()) {} + + // Implicit constructor: map-like objects (std::map, std::unordered_map, etc) + template <class M, typename std::enable_if< + std::is_constructible<std::string, typename M::key_type>::value + && std::is_constructible<Json, typename M::mapped_type>::value, + int>::type = 0> + Json(const M & m) : Json(object(m.begin(), m.end())) {} + + // Implicit constructor: vector-like objects (std::list, std::vector, std::set, etc) + template <class V, typename std::enable_if< + std::is_constructible<Json, typename V::value_type>::value, + int>::type = 0> + Json(const V & v) : Json(array(v.begin(), v.end())) {} + + // This prevents Json(some_pointer) from accidentally producing a bool. Use + // Json(bool(some_pointer)) if that behavior is desired. + Json(void *) = delete; + + // Accessors + Type type() const; + + bool is_null() const { return type() == NUL; } + bool is_number() const { return type() == NUMBER; } + bool is_bool() const { return type() == BOOL; } + bool is_string() const { return type() == STRING; } + bool is_array() const { return type() == ARRAY; } + bool is_object() const { return type() == OBJECT; } + + + // Return the enclosed value if this is a number, 0 otherwise. Note that json11 does not + // distinguish between integer and non-integer numbers - number_value() and int_value() + // can both be applied to a NUMBER-typed object. + double number_value() const; + int int_value() const; + + // Return the enclosed value if this is a boolean, false otherwise. + bool bool_value() const; + // Return the enclosed string if this is a string, "" otherwise. + const std::string &string_value() const; + // Return the enclosed std::vector if this is an array, or an empty vector otherwise. + const array &array_items() const; + // Return the enclosed std::map if this is an object, or an empty map otherwise. + const object &object_items() const; + + // Return a reference to arr[i] if this is an array, Json() otherwise. + const Json & operator[](size_t i) const; + // Return a reference to obj[key] if this is an object, Json() otherwise. + const Json & operator[](const std::string &key) const; + + // Serialize. + void dump(std::string &out) const; + std::string dump() const { + std::string out; + dump(out); + return out; + } + + // Parse. If parse fails, return Json() and assign an error message to err. + static Json parse(const std::string & in, + std::string & err, + JsonParse strategy = JsonParse::STANDARD); + static Json parse(const char * in, + std::string & err, + JsonParse strategy = JsonParse::STANDARD) { + if (in) { + return parse(std::string(in), err, strategy); + } else { + err = "null input"; + return nullptr; + } + } + // Parse multiple objects, concatenated or separated by whitespace + static std::vector<Json> parse_multi( + const std::string & in, + std::string::size_type & parser_stop_pos, + std::string & err, + JsonParse strategy = JsonParse::STANDARD); + + static inline std::vector<Json> parse_multi( + const std::string & in, + std::string & err, + JsonParse strategy = JsonParse::STANDARD) { + std::string::size_type parser_stop_pos; + return parse_multi(in, parser_stop_pos, err, strategy); + } + + bool operator== (const Json &rhs) const; + bool operator< (const Json &rhs) const; + bool operator!= (const Json &rhs) const { return !(*this == rhs); } + bool operator<= (const Json &rhs) const { return !(rhs < *this); } + bool operator> (const Json &rhs) const { return (rhs < *this); } + bool operator>= (const Json &rhs) const { return !(*this < rhs); } + + /* has_shape(types, err) + * + * Return true if this is a JSON object and, for each item in types, has a field of + * the given type. If not, return false and set err to a descriptive message. + */ + typedef std::initializer_list<std::pair<std::string, Type>> shape; + bool has_shape(const shape & types, std::string & err) const; + +private: + std::shared_ptr<JsonValue> m_ptr; +}; + +// Internal class hierarchy - JsonValue objects are not exposed to users of this API. +class JsonValue { +protected: + friend class Json; + friend class JsonInt; + friend class JsonDouble; + virtual Json::Type type() const = 0; + virtual bool equals(const JsonValue * other) const = 0; + virtual bool less(const JsonValue * other) const = 0; + virtual void dump(std::string &out) const = 0; + virtual double number_value() const; + virtual int int_value() const; + virtual bool bool_value() const; + virtual const std::string &string_value() const; + virtual const Json::array &array_items() const; + virtual const Json &operator[](size_t i) const; + virtual const Json::object &object_items() const; + virtual const Json &operator[](const std::string &key) const; + virtual ~JsonValue() {} + +}; + +} // namespace json11
View file
x265_2.4.tar.gz/source/dynamicHDR10/metadataFromJson.cpp
Added
@@ -0,0 +1,578 @@ +/** + * @file metadataFromJson.cpp + * @brief Reads a JSON file and produces a byte array containing the metadata to be embedded in different ways. + * @author Daniel Maximiliano Valenzuela, Seongnam Oh. + * @create date 03/01/2017 + * @version 0.0.1 + * + * Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. +**/ + +#include "metadataFromJson.h" + +#include <fstream> +#include <iostream> +#include <math.h> +#include "sstream" +#include "sys/stat.h" + +#include "BasicStructures.h" +#include "SeiMetadataDictionary.h" + +#define M_PI 3.14159265358979323846 + +using namespace SeiMetadataDictionary; + +class metadataFromJson::DynamicMetaIO +{ +public: + DynamicMetaIO() : + mCurrentStreamBit(8), + mCurrentStreamByte(0) + {} + + ~DynamicMetaIO(){} + + int mCurrentStreamBit; + int mCurrentStreamByte; + + bool luminanceParamFromJson(const Json &data, LuminanceParameters &obj) + { + JsonObject lumJsonData = data.object_items(); + if(!lumJsonData.empty()) + { + JsonObject percentileData = lumJsonData[PercentileNames::TagName].object_items(); + obj.order = percentileData[PercentileNames::NumberOfPercentiles].int_value(); + + obj.averageLuminance = static_cast<float>(lumJsonData[LuminanceNames::AverageRGB].number_value()); + obj.maxRLuminance = static_cast<float>(lumJsonData[LuminanceNames::MaxSCL0].number_value()); + obj.maxGLuminance = static_cast<float>(lumJsonData[LuminanceNames::MaxSCL1].number_value()); + obj.maxBLuminance = static_cast<float>(lumJsonData[LuminanceNames::MaxSCL2].number_value()); + + if(!percentileData.empty()) + { + obj.percentiles.resize(obj.order); + for(int i = 0; i < obj.order; ++i) + { + std::string percentileTag = PercentileNames::TagName; + percentileTag += std::to_string(i); + obj.percentiles[i] = static_cast<unsigned int>(percentileData[percentileTag].int_value()); + } + } + + return true; + } + return false; + } + + bool percentagesFromJson(const Json &data, std::vector<unsigned int> &percentages) + { + JsonObject jsonData = data.object_items(); + if(!jsonData.empty()) + { + JsonObject percentileData = jsonData[PercentileNames::TagName].object_items(); + int order = percentileData[PercentileNames::NumberOfPercentiles].int_value(); + + percentages.resize(order); + for(int i = 0; i < order; ++i) + { + std::string percentileTag = PercentileNames::PercentilePercentageValue[i]; + percentages[i] = static_cast<unsigned int>(percentileData[percentileTag].int_value()); + } + + return true; + } + return false; + } + + bool percentagesFromJson(const Json &data, unsigned int *percentages) + { + JsonObject jsonData = data.object_items(); + if(!jsonData.empty()) + { + JsonObject percentileData = jsonData[PercentileNames::TagName].object_items(); + int order = percentileData[PercentileNames::NumberOfPercentiles].int_value(); + + for(int i = 0; i < order; ++i) + { + std::string percentileTag = PercentileNames::PercentilePercentageValue[i]; + percentages[i] = static_cast<unsigned int>(percentileData[percentileTag].int_value()); + } + + return true; + } + return false; + } + + bool bezierCurveFromJson(const Json &data, BezierCurveData &obj) + { + JsonObject jsonData = data.object_items(); + if(!jsonData.empty()) + { + obj.order = jsonData[BezierCurveNames::NumberOfAnchors].int_value(); + obj.coeff.resize(obj.order); + obj.sPx = jsonData[BezierCurveNames::KneePointX].int_value(); + obj.sPy = jsonData[BezierCurveNames::KneePointY].int_value(); + for(int i = 0; i < obj.order; ++i) + { + obj.coeff[i] = jsonData[BezierCurveNames::Anchors[i]].int_value(); + } + + return true; + } + return false; + } + + template<typename T> + void appendBits(uint8_t *dataStream, T data, int bitsToWrite) + { + //TODO: Check if bitsToWrite is <= sizeOf(T); + while (bitsToWrite > 0) + { + /* if all data to write fits inside the current byte */ + if (bitsToWrite < mCurrentStreamBit ) + { + int bitshift = mCurrentStreamBit - bitsToWrite; + dataStream[mCurrentStreamByte] += static_cast<uint8_t>(data << bitshift); + mCurrentStreamBit -= bitsToWrite; + bitsToWrite = 0; + } + /* if all data to write needs more than the current byte space */ + else + { + int bitshift = bitsToWrite - mCurrentStreamBit; + dataStream[mCurrentStreamByte] += static_cast<uint8_t>(data >> bitshift); + bitsToWrite -= mCurrentStreamBit ; + mCurrentStreamBit = 8; + mCurrentStreamByte++; + } + } + } + + void setPayloadSize(uint8_t *dataStream, int positionOnStream, int payload) + { + int payloadBytes = 1; + + for(;payload > 0xFF; payload -= 0xFF, ++payloadBytes); + + if(payloadBytes > 1) + { + shiftData(dataStream, payloadBytes-1, mCurrentStreamByte, positionOnStream); + mCurrentStreamByte += payloadBytes-1; + + for(int i = 0; i < payloadBytes; ++i) + { + if(payloadBytes-1 == i) + { + dataStream[positionOnStream++] = static_cast<uint8_t>(payload); + } + else + { + dataStream[positionOnStream++] = 0xFF; + } + } + } + else + { + dataStream[positionOnStream] = static_cast<uint8_t>(payload); + } + } + + void shiftData(uint8_t *dataStream, int shiftSize, int streamSize, int startPoint = 0) + { + for(int i = streamSize; i > startPoint; --i) + { + dataStream[i + shiftSize] = dataStream[i]; + } + } + +// const std::string LocalParameters = std::string("LocalParameters"); +// const std::string TargetDisplayLuminance = std::string("TargetedSystemDisplayMaximumLuminance"); +}; + +metadataFromJson::metadataFromJson() : + mPimpl(new DynamicMetaIO()) +{ + +} + +metadataFromJson::~metadataFromJson() +{ + delete mPimpl; +} + + +bool metadataFromJson::frameMetadataFromJson(const char* filePath, + int frame, + uint8_t *&metadata) +{ + std::string path(filePath); + JsonArray fileData = JsonHelper::readJsonArray(path); + + if(fileData.empty()) + { + return false; + } + +// frame = frame + 1; //index on the array start at 0 frames starts at 1 + int numFrames = static_cast<int>(fileData.size()); + + if(frame >= numFrames) + { + return false; + } + + int mSEIBytesToRead = 509; + + if(metadata) + { + delete(metadata); + } + metadata = new uint8_t[mSEIBytesToRead]; + mPimpl->mCurrentStreamBit = 8; + mPimpl->mCurrentStreamByte = 1; + + for(int j = 0; j < mSEIBytesToRead; ++j) + { + (metadata)[j] = 0; + } + + fillMetadataArray(fileData, frame, metadata); + mPimpl->setPayloadSize(metadata, 0, mPimpl->mCurrentStreamByte); + return true; +} + +int metadataFromJson::movieMetadataFromJson(const char* filePath, uint8_t **&metadata) +{ + std::string path(filePath); + JsonArray fileData = JsonHelper::readJsonArray(path); + if (fileData.empty()) + { + return -1; + } + + int numFrames = static_cast<int>(fileData.size()); + metadata = new uint8_t*[numFrames]; + for (int frame = 0; frame < numFrames; ++frame) + { + metadata[frame] = new uint8_t[509]; + for (int i = 0; i < 509; ++i) + { + metadata[frame][i] = 0; + } + mPimpl->mCurrentStreamBit = 8; + mPimpl->mCurrentStreamByte = 1; + + fillMetadataArray(fileData, frame, metadata[frame]); + + mPimpl->setPayloadSize(metadata[frame], 0, mPimpl->mCurrentStreamByte); + + } + + return numFrames; +} + +bool metadataFromJson::extendedInfoFrameMetadataFromJson(const char* filePath, + int frame, + uint8_t *&metadata) +{ + std::string path(filePath); + JsonArray fileData = JsonHelper::readJsonArray(path); + + if (fileData.empty()) + { + return false; + } + + int numFrames = static_cast<int>(fileData.size()); + if (frame >= numFrames) + { + return false; + } + + int mSEIBytesToRead = 509; + + if (metadata) + { + delete(metadata); + } + metadata = new uint8_t[mSEIBytesToRead]; + mPimpl->mCurrentStreamBit = 8; + mPimpl->mCurrentStreamByte = 0; + + for (int j = 0; j < mSEIBytesToRead; ++j) + { + (metadata)[j] = 0; + } + + const uint16_t extendedInfoframeType = 0x0004; + mPimpl->appendBits(metadata, extendedInfoframeType, 16); + + /* NOTE: We leave TWO BYTES of space for the payload */ + mPimpl->mCurrentStreamByte += 2; + + fillMetadataArray(fileData, frame, metadata); + + /* Set payload in bytes 2 & 3 as indicated in Extended InfoFrame Type syntax */ + metadata[2] = (mPimpl->mCurrentStreamByte & 0xFF00) >> 8; + metadata[3] = (mPimpl->mCurrentStreamByte & 0x00FF); + return true; +} + +int metadataFromJson::movieExtendedInfoFrameMetadataFromJson(const char* filePath, uint8_t **&metadata) +{ + std::string path(filePath); + JsonArray fileData = JsonHelper::readJsonArray(path); + if(fileData.empty()) + { + return -1; + } + + int numFrames = static_cast<int>(fileData.size()); + metadata = new uint8_t*[numFrames]; + for(int frame = 0; frame < numFrames; ++frame) + { + metadata[frame] = new uint8_t[509]; + for(int i = 0; i < 509; ++i) + { + metadata[frame][i] = 0; + } + mPimpl->mCurrentStreamBit = 8; + mPimpl->mCurrentStreamByte = 0; + + const uint16_t extendedInfoframeType = 0x0004; + mPimpl->appendBits(metadata[frame], extendedInfoframeType, 16); + + /* NOTE: We leave TWO BYTES of space for the payload */ + mPimpl->mCurrentStreamByte += 2; + + fillMetadataArray(fileData, frame, metadata[frame]); + + /* Set payload in bytes 2 & 3 as indicated in Extended InfoFrame Type syntax */ + metadata[frame][2] = (mPimpl->mCurrentStreamByte & 0xFF00) >> 8; + metadata[frame][3] = (mPimpl->mCurrentStreamByte & 0x00FF); + } + + return numFrames; +} + +void metadataFromJson::fillMetadataArray(const JsonArray &fileData, int frame, uint8_t *&metadata) +{ + const uint8_t countryCode = 0xB5; + const uint16_t terminalProviderCode = 0x003C; + const uint16_t terminalProviderOrientedCode = 0x0001; + const uint8_t applicationIdentifier = 4; + const uint8_t applicationVersion = 0; + + mPimpl->appendBits(metadata, countryCode, 8); + mPimpl->appendBits(metadata, terminalProviderCode, 16); + mPimpl->appendBits(metadata, terminalProviderOrientedCode, 16); + + mPimpl->appendBits(metadata, applicationIdentifier, 8); + mPimpl->appendBits(metadata, applicationVersion, 8); + + //Note: Validated only add up to two local selections, ignore the rest + JsonArray jsonArray = fileData[frame][JsonDataKeys::LocalParameters].array_items(); + int ellipsesNum = static_cast<int>(jsonArray.size() > 2 ? 2 : jsonArray.size()); + + uint16_t numWindows = 1 + static_cast<uint16_t>(ellipsesNum); + + mPimpl->appendBits(metadata, numWindows, 2); + for (int i = 0; i < ellipsesNum; ++i) + { + mPimpl->appendBits(metadata, jsonArray[i][EllipseSelectionNames::WindowData] + [EllipseSelectionNames::WindowUpperLeftCornerX].int_value(), 16); + mPimpl->appendBits(metadata, jsonArray[i][EllipseSelectionNames::WindowData] + [EllipseSelectionNames::WindowUpperLeftCornerY].int_value(), 16); + mPimpl->appendBits(metadata, jsonArray[i][EllipseSelectionNames::WindowData] + [EllipseSelectionNames::WindowLowerRightCornerX].int_value(), 16); + mPimpl->appendBits(metadata, jsonArray[i][EllipseSelectionNames::WindowData] + [EllipseSelectionNames::WindowLowerRightCornerY].int_value(), 16); + + JsonObject ellipseJsonObject = jsonArray[i][EllipseNames::TagName].object_items(); + + mPimpl->appendBits(metadata, + static_cast<uint16_t>(ellipseJsonObject[EllipseNames::CenterOfEllipseX].int_value()), + 16); + + mPimpl->appendBits(metadata, + static_cast<uint16_t>(ellipseJsonObject[EllipseNames::CenterOfEllipseY].int_value()), + 16); + + int angle = ellipseJsonObject[EllipseNames::RotationAngle].int_value(); + uint8_t rotationAngle = static_cast<uint8_t>((angle > 180.0) ? angle - 180.0 : angle); + mPimpl->appendBits(metadata, rotationAngle, 8); + + uint16_t semimajorExternalAxis = + static_cast<uint16_t>(ellipseJsonObject[EllipseNames::SemiMajorAxisExternalEllipse].int_value()); + + uint16_t semiminorExternalAxis = + static_cast<uint16_t>(ellipseJsonObject[EllipseNames::SemiMinorAxisExternalEllipse].int_value()); + + uint16_t semimajorInternalEllipse = + static_cast<uint16_t>(ellipseJsonObject[EllipseNames::SemiMajorAxisInternalEllipse].int_value()); + + mPimpl->appendBits(metadata, semimajorInternalEllipse, 16); + + mPimpl->appendBits(metadata, semimajorExternalAxis, 16); + mPimpl->appendBits(metadata, semiminorExternalAxis, 16); + /*bool*/ uint8_t overlapProcessOption = static_cast<uint8_t>(ellipseJsonObject[EllipseNames::OverlapProcessOption].int_value()); //1; + //TODO: Uses Layering method, the value is "1" + mPimpl->appendBits(metadata, overlapProcessOption, 1); + } + /* Targeted System Display Data */ + uint32_t TEMPmonitorPeak = fileData[frame][JsonDataKeys::TargetDisplayLuminance].int_value(); //500; + mPimpl->appendBits(metadata, TEMPmonitorPeak, 27); + + //NOTE: Set as false for now, as requested + /*bool*/uint8_t targetedSystemDisplayActualPeakLuminanceFlag = 0; /*false*/ + mPimpl->appendBits(metadata, targetedSystemDisplayActualPeakLuminanceFlag, 1); + if (targetedSystemDisplayActualPeakLuminanceFlag) + { + //TODO + } + + /* Max rgb values (maxScl)*/ + /* Luminance values/percentile for each window */ + for (int w = 0; w < numWindows; ++w) + { + Json lumObj = fileData[frame][LuminanceNames::TagName]; + LuminanceParameters luminanceData; + if (!mPimpl->luminanceParamFromJson(lumObj, luminanceData)) + { + std::cout << "error parsing luminance parameters frame: " << w << std::endl; + } + + /* NOTE: Maxscl from 0 t 100,000 based on data that says in values of 0.00001 + * one for each channel R,G,B + */ + + mPimpl->appendBits(metadata, static_cast<uint8_t>(((int)luminanceData.maxRLuminance & 0x10000) >> 16), 1); + mPimpl->appendBits(metadata, static_cast<uint16_t>((int)luminanceData.maxRLuminance & 0xFFFF), 16); + mPimpl->appendBits(metadata, static_cast<uint8_t>(((int)luminanceData.maxGLuminance & 0x10000) >> 16), 1); + mPimpl->appendBits(metadata, static_cast<uint16_t>((int)luminanceData.maxGLuminance & 0xFFFF), 16); + mPimpl->appendBits(metadata, static_cast<uint8_t>(((int)luminanceData.maxBLuminance & 0x10000) >> 16), 1); + mPimpl->appendBits(metadata, static_cast<uint16_t>((int)luminanceData.maxBLuminance & 0xFFFF), 16); + /* changed from maxRGBLuminance to average luminance to match stms implementation */ + mPimpl->appendBits(metadata, static_cast<uint8_t>(((int)luminanceData.averageLuminance & 0x10000) >> 16), 1); + mPimpl->appendBits(metadata, static_cast<uint16_t>((int)luminanceData.averageLuminance & 0xFFFF), 16); + + /* Percentiles */ + uint8_t numDistributionMaxrgbPercentiles = static_cast<uint8_t>(luminanceData.order); + mPimpl->appendBits(metadata, numDistributionMaxrgbPercentiles, 4); + + std::vector<unsigned int>percentilPercentages; + mPimpl->percentagesFromJson(lumObj, percentilPercentages); + for (int i = 0; i < numDistributionMaxrgbPercentiles; ++i) + { + uint8_t distributionMaxrgbPercentage = static_cast<uint8_t>(percentilPercentages.at(i)); + mPimpl->appendBits(metadata, distributionMaxrgbPercentage, 7); + + // 17bits: 1bit then 16 + unsigned int ithPercentile = luminanceData.percentiles.at(i); + uint8_t highValue = static_cast<uint8_t>((ithPercentile & 0x10000) >> 16); + uint16_t lowValue = static_cast<uint16_t>(ithPercentile & 0xFFFF); + mPimpl->appendBits(metadata, highValue, 1); + mPimpl->appendBits(metadata, lowValue, 16); + } + + /* 10bits: Fraction bright pixels */ + uint16_t fractionBrightPixels = 1; + mPimpl->appendBits(metadata, fractionBrightPixels, 10); + + } + + /* Note: Set to false by now as requested */ + uint8_t masteringDisplayActualPeakLuminanceFlag = 0; + mPimpl->appendBits(metadata, masteringDisplayActualPeakLuminanceFlag, 1); + if (masteringDisplayActualPeakLuminanceFlag) + { + //TODO + } + // BEZIER CURVE DATA + for (int w = 0; w < numWindows; ++w) + { + //TODO: + uint8_t toneMappingFlag = 1; + mPimpl->appendBits(metadata, toneMappingFlag, 1); + if (toneMappingFlag) + { + Json bezierData = fileData[frame][BezierCurveNames::TagName]; + BezierCurveData curveData; + + /* Select curve data based on global window or local window */ + if (w == 0) + { + if (!mPimpl->bezierCurveFromJson(bezierData, curveData)) + { + std::cout << "error parsing bezierCurve frame: " << w << std::endl; + } + } + else + { + if (!mPimpl->bezierCurveFromJson(jsonArray[w - 1][BezierCurveNames::TagName], curveData)) + { + std::cout << "error parsing bezierCurve ellipse: " << w - 1 << std::endl; + } + } + + uint16_t kneePointX = static_cast<uint16_t>(curveData.sPx); + mPimpl->appendBits(metadata, kneePointX, 12); + uint16_t kneePointY = static_cast<uint16_t>(curveData.sPy); + mPimpl->appendBits(metadata, kneePointY, 12); + + uint8_t numBezierCurveAnchors = static_cast<uint8_t>(curveData.order);// - 1; + mPimpl->appendBits(metadata, numBezierCurveAnchors, 4); + + /* Curve anchors 10bits */ + for (int i = 0; i < numBezierCurveAnchors; ++i) + { + uint16_t anchor = static_cast<uint16_t>(curveData.coeff.at(i)); + mPimpl->appendBits(metadata, anchor, 10); + } + } + } + /* Set to false as requested */ + bool colorSaturationMappingFlag = 0; + mPimpl->appendBits(metadata, colorSaturationMappingFlag, 1); + if (colorSaturationMappingFlag) + { + //TODO + } + + if (mPimpl->mCurrentStreamBit == 8) + { + mPimpl->mCurrentStreamByte -= 1; + } +} + +void metadataFromJson::clear(uint8_t **&metadata, const int numberOfFrames) +{ + if (metadata && numberOfFrames > 0) + { + for (int i = 0; i < numberOfFrames; ++i) + { + if (metadata[i]) + { + delete[] metadata[i]; + } + } + delete[] metadata; + metadata = NULL; + } +}
View file
x265_2.4.tar.gz/source/dynamicHDR10/metadataFromJson.h
Added
@@ -0,0 +1,106 @@ +/** + * @file metadataFromJson.h + * @brief Reads a JSON file and produces a byte array containing the metadata to be embedded for a frame. + * @author Daniel Maximiliano Valenzuela, Seongnam Oh. + * @create date 03/01/2017 + * @version 0.0.1 + * + * Copyright @ 2017 Samsung Electronics, DMS Lab, Samsung Research America and Samsung Research Tijuana + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + +**/ + +#ifndef METADATAFROMJSON_H +#define METADATAFROMJSON_H + +#include<stdint.h> +#include "string" +#include "JsonHelper.h" + +class metadataFromJson +{ + +public: + metadataFromJson(); + ~metadataFromJson(); + + + /** + * @brief frameMetadataFromJson: Generates a sigle frame metadata array from Json file with all + * metadata information from movie. + * @param filePath: path to Json file containing movie metadata information. + * @param frame: frame Id number in respect to the movie. + * @param metadata (output): receives an empty pointer that will be set to point to metadata + * array. Note: if pointer is set it will be deleted. + * @return True if succesful + */ + bool frameMetadataFromJson(const char* filePath, + int frame, + uint8_t *&metadata); + + /** + * @brief movieMetadataFromJson: Generates metadata array from Json file with all metadata + * information from movie. + * @param filePath: path to Json file containing movie metadata information. + * @param metadata (output): receives an empty pointer that will be set to point to metadata + * array. Note: if pointer is set it will be deleted. + * @return int: number of frames in the movie, -1 if the process fails to obtain the metadata. + */ + int movieMetadataFromJson(const char* filePath, + uint8_t **&metadata); + + /** + * @brief extendedInfoFrameMetadataFromJson: Generates Extended InfoFrame metadata array from Json file + * with all metadata information from movie. + * @param filePath: path to Json file containing movie metadata information. + * @param metadata (output): receives an empty pointer that will be set to point to metadata + * array. Note: if pointer is set it will be deleted. + * @return int: number of frames in the movie, -1 if the process fails to obtain the metadata. + */ + bool extendedInfoFrameMetadataFromJson(const char* filePath, + int frame, + uint8_t *&metadata); + + /** + * @brief movieMetadataFromJson: Generates Extended InfoFrame metadata array from Json file with all metadata + * information from movie. + * @param filePath: path to Json file containing movie Extended InfoFrame metadata information. + * @param metadata (output): receives an empty pointer that will be set to point to metadata + * array. Note: if pointer is set it will be deleted. + * @return int: number of frames in the movie, -1 if the process fails to obtain the metadata. + */ + int movieExtendedInfoFrameMetadataFromJson(const char* filePath, + uint8_t **&metadata); + + /** + + * @brief clear: Clears the memory of the given array and size. + * @param metadata: metadata array to be cleared. + * @param numberOfFrames: number of frames in the metadata array. + * @return + */ + void clear(uint8_t **&metadata, + const int numberOfFrames); + +private: + + class DynamicMetaIO; + DynamicMetaIO *mPimpl; + void fillMetadataArray(const JsonArray &fileData, int frame, uint8_t *&metadata); +}; + +#endif // METADATAFROMJSON_H
View file
x265_2.3.tar.gz/source/encoder/analysis.cpp -> x265_2.4.tar.gz/source/encoder/analysis.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com> * Steve Borho <steve@borho.org> @@ -167,15 +167,18 @@ } } - if (m_param->analysisMode && m_slice->m_sliceType != I_SLICE) + if (m_param->analysisMode && m_slice->m_sliceType != I_SLICE && m_param->analysisRefineLevel > 1 && m_param->analysisRefineLevel < 10) { int numPredDir = m_slice->isInterP() ? 1 : 2; m_reuseInterDataCTU = (analysis_inter_data*)m_frame->m_analysisData.interData; m_reuseRef = &m_reuseInterDataCTU->ref[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir]; m_reuseDepth = &m_reuseInterDataCTU->depth[ctu.m_cuAddr * ctu.m_numPartitions]; m_reuseModes = &m_reuseInterDataCTU->modes[ctu.m_cuAddr * ctu.m_numPartitions]; - m_reusePartSize = &m_reuseInterDataCTU->partSize[ctu.m_cuAddr * ctu.m_numPartitions]; - m_reuseMergeFlag = &m_reuseInterDataCTU->mergeFlag[ctu.m_cuAddr * ctu.m_numPartitions]; + if (m_param->analysisRefineLevel > 4) + { + m_reusePartSize = &m_reuseInterDataCTU->partSize[ctu.m_cuAddr * ctu.m_numPartitions]; + m_reuseMergeFlag = &m_reuseInterDataCTU->mergeFlag[ctu.m_cuAddr * ctu.m_numPartitions]; + } if (m_param->analysisMode == X265_ANALYSIS_SAVE) for (int i = 0; i < X265_MAX_PRED_MODE_PER_CTU * numPredDir; i++) m_reuseRef[i] = -1; @@ -185,7 +188,7 @@ if (m_slice->m_sliceType == I_SLICE) { analysis_intra_data* intraDataCTU = (analysis_intra_data*)m_frame->m_analysisData.intraData; - if (m_param->analysisMode == X265_ANALYSIS_LOAD) + if (m_param->analysisMode == X265_ANALYSIS_LOAD && m_param->analysisRefineLevel > 1) { memcpy(ctu.m_cuDepth, &intraDataCTU->depth[ctu.m_cuAddr * numPartition], sizeof(uint8_t) * numPartition); memcpy(ctu.m_lumaIntraDir, &intraDataCTU->modes[ctu.m_cuAddr * numPartition], sizeof(uint8_t) * numPartition); @@ -211,6 +214,26 @@ /* generate residual for entire CTU at once and copy to reconPic */ encodeResidue(ctu, cuGeom); } + else if (m_param->analysisMode == X265_ANALYSIS_LOAD && m_param->analysisRefineLevel == 10) + { + analysis_inter_data* interDataCTU = (analysis_inter_data*)m_frame->m_analysisData.interData; + int posCTU = ctu.m_cuAddr * numPartition; + memcpy(ctu.m_cuDepth, &interDataCTU->depth[posCTU], sizeof(uint8_t) * numPartition); + memcpy(ctu.m_predMode, &interDataCTU->modes[posCTU], sizeof(uint8_t) * numPartition); + memcpy(ctu.m_partSize, &interDataCTU->partSize[posCTU], sizeof(uint8_t) * numPartition); + if (m_slice->m_sliceType == P_SLICE || m_param->bIntraInBFrames) + { + analysis_intra_data* intraDataCTU = (analysis_intra_data*)m_frame->m_analysisData.intraData; + memcpy(ctu.m_lumaIntraDir, &intraDataCTU->modes[posCTU], sizeof(uint8_t) * numPartition); + memcpy(ctu.m_chromaIntraDir, &intraDataCTU->chromaModes[posCTU], sizeof(uint8_t) * numPartition); + } + //Calculate log2CUSize from depth + for (uint32_t i = 0; i < cuGeom.numPartitions; i++) + ctu.m_log2CUSize[i] = (uint8_t)g_maxLog2CUSize - ctu.m_cuDepth[i]; + + qprdRefine (ctu, cuGeom, qp, qp); + return *m_modeDepth[0].bestMode; + } else if (m_param->bDistributeModeAnalysis && m_param->rdLevel >= 2) compressInterCU_dist(ctu, cuGeom, qp); else if (m_param->rdLevel <= 4) @@ -313,6 +336,8 @@ int lambdaQP = lqp; bool doQPRefine = (bDecidedDepth && depth <= m_slice->m_pps->maxCuDQPDepth) || (!bDecidedDepth && depth == m_slice->m_pps->maxCuDQPDepth); + if (m_param->analysisRefineLevel == 10) + doQPRefine = false; if (doQPRefine) { @@ -1015,7 +1040,7 @@ md.pred[PRED_2Nx2N].sa8dCost = 0; } - if (m_param->analysisMode == X265_ANALYSIS_LOAD) + if (m_param->analysisMode == X265_ANALYSIS_LOAD && m_param->analysisRefineLevel > 1) { if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx]) { @@ -1029,7 +1054,7 @@ if (m_param->rdLevel) skipModes = m_param->bEnableEarlySkip && md.bestMode; } - if (m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N) + if (m_param->analysisRefineLevel > 4 && m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N) { if (m_reuseModes[cuGeom.absPartIdx] != MODE_INTRA && m_reuseModes[cuGeom.absPartIdx] != 4) { @@ -1582,7 +1607,7 @@ splitData[3].initSplitCUData(); uint32_t allSplitRefs = splitData[0].splitRefs | splitData[1].splitRefs | splitData[2].splitRefs | splitData[3].splitRefs; uint32_t refMasks[2]; - if (m_param->analysisMode == X265_ANALYSIS_LOAD) + if (m_param->analysisMode == X265_ANALYSIS_LOAD && m_param->analysisRefineLevel > 1) { if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx]) { @@ -1600,7 +1625,7 @@ if (m_param->bEnableRecursionSkip && depth && m_modeDepth[depth - 1].bestMode) skipRecursion = md.bestMode && !md.bestMode->cu.getQtRootCbf(0); } - if (m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N) + if (m_param->analysisRefineLevel > 4 && m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N) skipRectAmp = true && !!md.bestMode; } } @@ -2004,10 +2029,39 @@ else { mode.cu.copyFromPic(parentCTU, cuGeom, m_csp, false); - for (int part = 0; part < (int)parentCTU.getNumPartInter(cuGeom.absPartIdx); part++) + uint32_t numPU = parentCTU.getNumPartInter(cuGeom.absPartIdx); + for (uint32_t part = 0; part < numPU; part++) { PredictionUnit pu(mode.cu, cuGeom, part); - motionCompensation(mode.cu, pu, mode.predYuv, true, true); + if (m_param->analysisRefineLevel == 10) + { + analysis_inter_data* interDataCTU = (analysis_inter_data*)m_frame->m_analysisData.interData; + int cuIdx = (mode.cu.m_cuAddr * parentCTU.m_numPartitions) + cuGeom.absPartIdx; + mode.cu.m_mergeFlag[pu.puAbsPartIdx] = interDataCTU->mergeFlag[cuIdx + part]; + mode.cu.setPUInterDir(interDataCTU->interDir[cuIdx + part], pu.puAbsPartIdx, part); + for (int dir = 0; dir < m_slice->isInterB() + 1; dir++) + { + mode.cu.setPUMv(dir, interDataCTU->mv[dir][cuIdx + part], pu.puAbsPartIdx, part); + mode.cu.setPURefIdx(dir, interDataCTU->refIdx[dir][cuIdx + part], pu.puAbsPartIdx, part); + mode.cu.m_mvpIdx[dir][pu.puAbsPartIdx] = interDataCTU->mvpIdx[dir][cuIdx + part]; + } + if (!mode.cu.m_mergeFlag[pu.puAbsPartIdx]) + { + //AMVP + MV mvc[(MD_ABOVE_LEFT + 1) * 2 + 2]; + mode.cu.getNeighbourMV(part, pu.puAbsPartIdx, mode.interNeighbours); + for (int list = 0; list < m_slice->isInterB() + 1; list++) + { + int ref = mode.cu.m_refIdx[list][pu.puAbsPartIdx]; + if (ref == -1) + continue; + mode.cu.getPMV(mode.interNeighbours, list, ref, mode.amvpCand[list][ref], mvc); + MV mvp = mode.amvpCand[list][ref][mode.cu.m_mvpIdx[list][pu.puAbsPartIdx]]; + mode.cu.m_mvd[list][pu.puAbsPartIdx] = mode.cu.m_mv[list][pu.puAbsPartIdx] - mvp; + } + } + } + motionCompensation(mode.cu, pu, mode.predYuv, true, (m_csp != X265_CSP_I400 && m_frame->m_fencPic->m_picCsp != X265_CSP_I400)); } if (parentCTU.isSkipped(cuGeom.absPartIdx)) @@ -2016,7 +2070,7 @@ encodeResAndCalcRdInterCU(mode, cuGeom); /* checkMerge2Nx2N function performs checkDQP after encoding residual, do the same */ - bool mergeInter2Nx2N = size == SIZE_2Nx2N && parentCTU.m_mergeFlag[cuGeom.absPartIdx]; + bool mergeInter2Nx2N = size == SIZE_2Nx2N && mode.cu.m_mergeFlag[0]; if (parentCTU.isSkipped(cuGeom.absPartIdx) || mergeInter2Nx2N) checkDQP(mode, cuGeom); } @@ -2026,6 +2080,9 @@ if (mightSplit) addSplitFlagCost(*md.bestMode, cuGeom.depth); + + if (mightSplit && m_param->rdLevel < 5) + checkDQPForSplitPred(*md.bestMode, cuGeom); } else { @@ -2052,7 +2109,8 @@ if (m_slice->m_pps->bUseDQP && nextDepth <= m_slice->m_pps->maxCuDQPDepth) nextQP = setLambdaFromQP(parentCTU, calculateQpforCuSize(parentCTU, childGeom)); - qprdRefine(parentCTU, childGeom, nextQP, lqp); + int lamdaQP = m_param->analysisRefineLevel == 10 ? nextQP : lqp; + qprdRefine(parentCTU, childGeom, nextQP, lamdaQP); // Save best CU and pred data for this sub CU splitCU->copyPartFrom(nd.bestMode->cu, childGeom, subPartIdx); @@ -2362,7 +2420,7 @@ interMode.cu.setPredModeSubParts(MODE_INTER); int numPredDir = m_slice->isInterP() ? 1 : 2; - if (m_param->analysisMode == X265_ANALYSIS_LOAD && m_reuseInterDataCTU) + if (m_param->analysisMode == X265_ANALYSIS_LOAD && m_reuseInterDataCTU && m_param->analysisRefineLevel > 1) { int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2; int index = 0; @@ -2404,7 +2462,7 @@ } interMode.sa8dCost = m_rdCost.calcRdSADCost((uint32_t)interMode.distortion, interMode.sa8dBits); - if (m_param->analysisMode == X265_ANALYSIS_SAVE && m_reuseInterDataCTU) + if (m_param->analysisMode == X265_ANALYSIS_SAVE && m_reuseInterDataCTU && m_param->analysisRefineLevel > 1) { int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2; int index = 0; @@ -2426,7 +2484,7 @@ interMode.cu.setPredModeSubParts(MODE_INTER); int numPredDir = m_slice->isInterP() ? 1 : 2; - if (m_param->analysisMode == X265_ANALYSIS_LOAD && m_reuseInterDataCTU) + if (m_param->analysisMode == X265_ANALYSIS_LOAD && m_reuseInterDataCTU && m_param->analysisRefineLevel > 1) { int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2; int index = 0; @@ -2460,7 +2518,7 @@ /* predInterSearch sets interMode.sa8dBits, but this is ignored */ encodeResAndCalcRdInterCU(interMode, cuGeom); - if (m_param->analysisMode == X265_ANALYSIS_SAVE && m_reuseInterDataCTU) + if (m_param->analysisMode == X265_ANALYSIS_SAVE && m_reuseInterDataCTU && m_param->analysisRefineLevel > 1) { int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2; int index = 0; @@ -2884,6 +2942,15 @@ { FrameData& curEncData = *m_frame->m_encData; double qp = baseQp >= 0 ? baseQp : curEncData.m_cuStat[ctu.m_cuAddr].baseQp; + + if (m_param->analysisMultiPassDistortion && m_param->rc.bStatRead) + { + m_multipassAnalysis = (analysis2PassFrameData*)m_frame->m_analysis2Pass.analysisFramedata; + if ((m_multipassAnalysis->threshold[ctu.m_cuAddr] < 0.9 || m_multipassAnalysis->threshold[ctu.m_cuAddr] > 1.1) + && m_multipassAnalysis->highDistortionCtuCount && m_multipassAnalysis->lowDistortionCtuCount) + qp += m_multipassAnalysis->offset[ctu.m_cuAddr]; + } + int loopIncr; if (m_param->rc.qgSize == 8) loopIncr = 8;
View file
x265_2.3.tar.gz/source/encoder/analysis.h -> x265_2.4.tar.gz/source/encoder/analysis.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com> * Steve Borho <steve@borho.org>
View file
x265_2.3.tar.gz/source/encoder/api.cpp -> x265_2.4.tar.gz/source/encoder/api.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * @@ -171,7 +171,7 @@ x265_param save; Encoder* encoder = static_cast<Encoder*>(enc); - if (encoder->m_reconfigure) /* Reconfigure in progress */ + if (encoder->m_reconfigure || encoder->m_reconfigureRc) /* Reconfigure in progress */ return 1; memcpy(&save, encoder->m_latestParam, sizeof(x265_param)); int ret = encoder->reconfigureParam(encoder->m_latestParam, param_in); @@ -197,7 +197,22 @@ return -1; } } - encoder->m_reconfigure = true; + if (encoder->m_reconfigureRc) + { + VPS saveVPS; + memcpy(&saveVPS.ptl, &encoder->m_vps.ptl, sizeof(saveVPS.ptl)); + determineLevel(*encoder->m_latestParam, encoder->m_vps); + if (saveVPS.ptl.profileIdc != encoder->m_vps.ptl.profileIdc || saveVPS.ptl.levelIdc != encoder->m_vps.ptl.levelIdc + || saveVPS.ptl.tierFlag != encoder->m_vps.ptl.tierFlag) + { + x265_log(encoder->m_param, X265_LOG_WARNING, "Profile/Level/Tier has changed from %d/%d/%s to %d/%d/%s.Cannot reconfigure rate-control.\n", + saveVPS.ptl.profileIdc, saveVPS.ptl.levelIdc, saveVPS.ptl.tierFlag ? "High" : "Main", encoder->m_vps.ptl.profileIdc, + encoder->m_vps.ptl.levelIdc, encoder->m_vps.ptl.tierFlag ? "High" : "Main"); + encoder->m_reconfigureRc = false; + } + } + else + encoder->m_reconfigure = true; encoder->printReconfigureParams(); } return ret; @@ -222,6 +237,7 @@ // encoder now owns these analysisData buffers. if (pic_in) { + pic_in->analysisData.wt = NULL; pic_in->analysisData.intraData = NULL; pic_in->analysisData.interData = NULL; pic_in->analysis2Pass.analysisFramedata = NULL;
View file
x265_2.3.tar.gz/source/encoder/bitcost.cpp -> x265_2.4.tar.gz/source/encoder/bitcost.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/bitcost.h -> x265_2.4.tar.gz/source/encoder/bitcost.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/encoder/dpb.cpp -> x265_2.4.tar.gz/source/encoder/dpb.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/dpb.h -> x265_2.4.tar.gz/source/encoder/dpb.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/encoder/encoder.cpp -> x265_2.4.tar.gz/source/encoder/encoder.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -56,6 +56,7 @@ { m_aborted = false; m_reconfigure = false; + m_reconfigureRc = false; m_encodedFrameNum = 0; m_pocLast = -1; m_curEncoder = 0; @@ -79,12 +80,18 @@ m_iFrameNum = 0; m_iPPSQpMinus26 = 0; m_rpsInSpsCount = 0; + m_cB = 1.0; + m_cR = 1.0; for (int i = 0; i < X265_MAX_FRAME_THREADS; i++) m_frameEncoder[i] = NULL; - MotionEstimate::initScales(); -} +#if ENABLE_DYNAMIC_HDR10 + m_hdr10plus_api = hdr10plus_api_get(); +#endif + + m_prevTonemapPayload.payload = NULL; +} inline char *strcatFilename(const char *input, const char *suffix) { char *output = X265_MALLOC(char, strlen(input) + strlen(suffix) + 1); @@ -345,10 +352,10 @@ if (!name) name = defaultAnalysisFileName; const char* mode = m_param->analysisMode == X265_ANALYSIS_LOAD ? "rb" : "wb"; - m_analysisFile = fopen(name, mode); + m_analysisFile = x265_fopen(name, mode); if (!m_analysisFile) { - x265_log(NULL, X265_LOG_ERROR, "Analysis load/save: failed to open file %s\n", name); + x265_log_file(NULL, X265_LOG_ERROR, "Analysis load/save: failed to open file %s\n", name); m_aborted = true; } } @@ -365,21 +372,21 @@ m_aborted = true; else { - m_analysisFileOut = fopen(temp, "wb"); + m_analysisFileOut = x265_fopen(temp, "wb"); X265_FREE(temp); } if (!m_analysisFileOut) { - x265_log(NULL, X265_LOG_ERROR, "Analysis 2 pass: failed to open file %s\n", temp); + x265_log_file(NULL, X265_LOG_ERROR, "Analysis 2 pass: failed to open file %s.temp\n", name); m_aborted = true; } } if (m_param->rc.bStatRead) { - m_analysisFileIn = fopen(name, "rb"); + m_analysisFileIn = x265_fopen(name, "rb"); if (!m_analysisFileIn) { - x265_log(NULL, X265_LOG_ERROR, "Analysis 2 pass: failed to open file %s\n", name); + x265_log_file(NULL, X265_LOG_ERROR, "Analysis 2 pass: failed to open file %s\n", name); m_aborted = true; } } @@ -486,7 +493,7 @@ } if (bError) { - x265_log(m_param, X265_LOG_ERROR, "failed to rename analysis stats file to \"%s\"\n", name); + x265_log_file(m_param, X265_LOG_ERROR, "failed to rename analysis stats file to \"%s\"\n", name); } X265_FREE(temp); } @@ -499,7 +506,7 @@ free((char*)m_param->scalingLists); free((char*)m_param->numaPools); free((char*)m_param->masteringDisplayColorVolume); - + free((char*)m_param->toneMapFile); PARAM_NS::x265_param_free(m_param); } } @@ -590,9 +597,24 @@ m_exportedPic = NULL; m_dpb->recycleUnreferenced(); } - if (pic_in) { + x265_sei_payload toneMap; + toneMap.payload = NULL; +#if ENABLE_DYNAMIC_HDR10 + if (m_bToneMap) + { + uint8_t *cim = NULL; + if (m_hdr10plus_api->hdr10plus_json_to_frame_cim(m_param->toneMapFile, pic_in->poc, cim)) + { + toneMap.payload = (uint8_t*)x265_malloc(sizeof(uint8_t) * cim[0]); + toneMap.payloadSize = cim[0]; + toneMap.payloadType = USER_DATA_REGISTERED_ITU_T_T35; + memcpy(toneMap.payload, cim, toneMap.payloadSize); + } + } +#endif + if (pic_in->bitDepth < 8 || pic_in->bitDepth > 16) { x265_log(m_param, X265_LOG_ERROR, "Input bit depth (%d) must be between 8 and 16\n", @@ -605,7 +627,7 @@ { inFrame = new Frame; inFrame->m_encodeStartTime = x265_mdate(); - x265_param* p = m_reconfigure ? m_latestParam : m_param; + x265_param* p = (m_reconfigure || m_reconfigureRc) ? m_latestParam : m_param; if (inFrame->create(p, pic_in->quantOffsets)) { /* the first PicYuv created is asked to generate the CU and block unit offset @@ -672,19 +694,31 @@ inFrame->m_userData = pic_in->userData; inFrame->m_pts = pic_in->pts; inFrame->m_forceqp = pic_in->forceqp; - inFrame->m_param = m_reconfigure ? m_latestParam : m_param; + inFrame->m_param = (m_reconfigure || m_reconfigureRc) ? m_latestParam : m_param; - if (pic_in->userSEI.numPayloads) + int toneMapEnable = 0; + if (m_bToneMap && toneMap.payload) + toneMapEnable = 1; + int numPayloads = pic_in->userSEI.numPayloads + toneMapEnable; + inFrame->m_userSEI.numPayloads = numPayloads; + + if (inFrame->m_userSEI.numPayloads) { - int numPayloads = inFrame->m_userSEI.numPayloads = pic_in->userSEI.numPayloads; inFrame->m_userSEI.payloads = new x265_sei_payload[numPayloads]; for (int i = 0; i < numPayloads; i++) { - int size = inFrame->m_userSEI.payloads[i].payloadSize = pic_in->userSEI.payloads[i].payloadSize; - inFrame->m_userSEI.payloads[i].payloadType = pic_in->userSEI.payloads[i].payloadType; + x265_sei_payload input; + if (i == (numPayloads - 1)) + input = toneMap; + else + input = pic_in->userSEI.payloads[i]; + int size = inFrame->m_userSEI.payloads[i].payloadSize = input.payloadSize; + inFrame->m_userSEI.payloads[i].payloadType = input.payloadType; inFrame->m_userSEI.payloads[i].payload = new uint8_t[size]; - memcpy(inFrame->m_userSEI.payloads[i].payload, pic_in->userSEI.payloads[i].payload, size); + memcpy(inFrame->m_userSEI.payloads[i].payload, input.payload, size); } + if (toneMap.payload) + x265_free(toneMap.payload); } if (pic_in->quantOffsets != NULL) @@ -731,12 +765,15 @@ inFrame->m_analysisData.satdCost = inputPic->analysisData.satdCost; inFrame->m_analysisData.numCUsInFrame = inputPic->analysisData.numCUsInFrame; inFrame->m_analysisData.numPartitions = inputPic->analysisData.numPartitions; + inFrame->m_analysisData.wt = inputPic->analysisData.wt; inFrame->m_analysisData.interData = inputPic->analysisData.interData; inFrame->m_analysisData.intraData = inputPic->analysisData.intraData; sliceType = inputPic->analysisData.sliceType; inFrame->m_lowres.bScenecut = !!inFrame->m_analysisData.bScenecut; inFrame->m_lowres.satdCost = inFrame->m_analysisData.satdCost; } + if (m_reconfigureRc) + inFrame->m_reconfigureRc = true; m_lookahead->addPicture(*inFrame, sliceType); m_numDelayedPic++; @@ -815,6 +852,7 @@ pic_out->analysisData.satdCost = outFrame->m_lowres.satdCost; pic_out->analysisData.numCUsInFrame = outFrame->m_analysisData.numCUsInFrame; pic_out->analysisData.numPartitions = outFrame->m_analysisData.numPartitions; + pic_out->analysisData.wt = outFrame->m_analysisData.wt; pic_out->analysisData.interData = outFrame->m_analysisData.interData; pic_out->analysisData.intraData = outFrame->m_analysisData.intraData; writeAnalysisFile(&pic_out->analysisData, *outFrame->m_encData); @@ -936,6 +974,15 @@ if (m_param->rc.bStatRead) readAnalysis2PassFile(&frameEnc->m_analysis2Pass, frameEnc->m_poc, frameEnc->m_lowres.sliceType); } + + if (frameEnc->m_reconfigureRc && m_reconfigureRc) + { + memcpy(m_param, m_latestParam, sizeof(x265_param)); + m_rateControl->reconfigureRC(); + m_reconfigureRc = false; + } + if (frameEnc->m_reconfigureRc && !m_reconfigureRc) + frameEnc->m_reconfigureRc = false; if (curEncoder->m_reconfigure) { /* One round robin cycle of FE reconfigure is complete */ @@ -1086,6 +1133,25 @@ encParam->bIntraInBFrames = param->bIntraInBFrames; if (param->scalingLists && !encParam->scalingLists) encParam->scalingLists = strdup(param->scalingLists); + /* VBV can't be turned ON if it wasn't ON to begin with and can't be turned OFF if it was ON to begin with*/ + if (param->rc.vbvMaxBitrate > 0 && param->rc.vbvBufferSize > 0 && + encParam->rc.vbvMaxBitrate > 0 && encParam->rc.vbvBufferSize > 0) + { + m_reconfigureRc |= encParam->rc.vbvMaxBitrate != param->rc.vbvMaxBitrate; + m_reconfigureRc |= encParam->rc.vbvBufferSize != param->rc.vbvBufferSize; + if (m_reconfigureRc && m_param->bEmitHRDSEI) + x265_log(m_param, X265_LOG_WARNING, "VBV parameters cannot be changed when HRD is in use.\n"); + else + { + encParam->rc.vbvMaxBitrate = param->rc.vbvMaxBitrate; + encParam->rc.vbvBufferSize = param->rc.vbvBufferSize; + } + } + m_reconfigureRc |= encParam->rc.bitrate != param->rc.bitrate; + encParam->rc.bitrate = param->rc.bitrate; + m_reconfigureRc |= encParam->rc.rfConstant != param->rc.rfConstant; + encParam->rc.rfConstant = param->rc.rfConstant; + /* To add: Loop Filter/deblocking controls, transform skip, signhide require PPS to be resent */ /* To add: SAO, temporal MVP, AMP, TU depths require SPS to be resent, at every CVS boundary */ return x265_check_params(encParam); @@ -1689,15 +1755,14 @@ if (buffer) { sprintf(buffer, "x265 (build %d) - %s:%s - H.265/HEVC codec - " - "Copyright 2013-2016 (c) Multicoreware Inc - " + "Copyright 2013-2017 (c) Multicoreware, Inc - " "http://x265.org - options: %s", X265_BUILD, PFX(version_str), PFX(build_info_str), opts); bs.resetBits(); SEIuserDataUnregistered idsei; - idsei.m_payloadType = USER_DATA_UNREGISTERED; idsei.m_userData = (uint8_t*)buffer; - idsei.m_userDataLength = (uint32_t)strlen(buffer); + idsei.setSize((uint32_t)strlen(buffer)); idsei.write(bs, m_sps); bs.writeByteAlignment(); list.serialize(NAL_UNIT_PREFIX_SEI, bs); @@ -1829,6 +1894,7 @@ pps->chromaQpOffset[0] = m_param->cbQpOffset; pps->chromaQpOffset[1] = m_param->crQpOffset; + pps->pps_slice_chroma_qp_offsets_present_flag = m_param->bHDROpt; pps->bConstrainedIntraPred = m_param->bEnableConstrainedIntra; pps->bUseWeightPred = m_param->bEnableWeightedPred; @@ -2104,7 +2170,7 @@ /* some options make no sense if others are disabled */ p->bSaoNonDeblocked &= p->bEnableSAO; p->bEnableTSkipFast &= p->bEnableTransformSkip; - + p->bLimitSAO &= p->bEnableSAO; /* initialize the conformance window */ m_conformanceWindow.bEnabled = false; m_conformanceWindow.rightOffset = 0; @@ -2162,6 +2228,40 @@ p->dynamicRd = 0; x265_log(p, X265_LOG_WARNING, "Dynamic-rd disabled, requires RD <= 4, VBV and aq-mode enabled\n"); } +#ifdef ENABLE_DYNAMIC_HDR10 + if (m_param->bDhdr10opt && m_param->toneMapFile == NULL) + { + x265_log(p, X265_LOG_WARNING, "Disabling dhdr10-opt. dhdr10-info must be enabled.\n"); + m_param->bDhdr10opt = 0; + } + + if (m_param->toneMapFile) + { + if (!x265_fopen(p->toneMapFile, "r")) + { + x265_log(p, X265_LOG_ERROR, "Unable to open tone-map file.\n"); + m_bToneMap = 0; + m_param->toneMapFile = NULL; + m_aborted = true; + } + else + m_bToneMap = 1; + } + else + m_bToneMap = 0; +#else + if (m_param->toneMapFile) + { + x265_log(p, X265_LOG_WARNING, "--dhdr10-info disabled. Enable dynamic HDR in cmake.\n"); + m_bToneMap = 0; + m_param->toneMapFile = NULL; + } + else if (m_param->bDhdr10opt) + { + x265_log(p, X265_LOG_WARNING, "Disabling dhdr10-opt. dhdr10-info must be enabled.\n"); + m_param->bDhdr10opt = 0; + } +#endif if (p->uhdBluray) { @@ -2286,14 +2386,26 @@ x265_log(p, X265_LOG_WARNING, "maxSlices can not be less than 1, force set to 1\n"); p->maxSlices = 1; } - const uint32_t numRows = (p->sourceHeight + p->maxCUSize - 1) / p->maxCUSize; const uint32_t slicesLimit = X265_MIN(numRows, NALList::MAX_NAL_UNITS - 1); - if (p->maxSlices > numRows) + if (p->maxSlices > slicesLimit) { x265_log(p, X265_LOG_WARNING, "maxSlices can not be more than min(rows, MAX_NAL_UNITS-1), force set to %d\n", slicesLimit); p->maxSlices = slicesLimit; } + if (p->bHDROpt) + { + if (p->internalCsp != X265_CSP_I420 || p->internalBitDepth != 10 || p->vui.colorPrimaries != 9 || + p->vui.transferCharacteristics != 16 || p->vui.matrixCoeffs != 9) + { + x265_log(p, X265_LOG_ERROR, "Recommended Settings for HDR: colour primaries should be BT.2020,\n" + " transfer characteristics should be SMPTE ST.2084,\n" + " matrix coeffs should be BT.2020,\n" + " the input video should be 10 bit 4:2:0\n" + " Disabling offset tuning for HDR videos\n"); + p->bHDROpt = 0; + } + } } void Encoder::allocAnalysis(x265_analysis_data* analysis) @@ -2302,6 +2414,9 @@ analysis->interData = analysis->intraData = NULL; if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I) { + if (m_param->analysisRefineLevel < 2) + return; + analysis_intra_data *intraData = (analysis_intra_data*)analysis->intraData; CHECKED_MALLOC_ZERO(intraData, analysis_intra_data, 1); CHECKED_MALLOC(intraData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame); @@ -2313,14 +2428,44 @@ else { int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2; + uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3; + CHECKED_MALLOC_ZERO(analysis->wt, WeightParam, numPlanes * numDir); + if (m_param->analysisRefineLevel < 2) + return; + analysis_inter_data *interData = (analysis_inter_data*)analysis->interData; CHECKED_MALLOC_ZERO(interData, analysis_inter_data, 1); - CHECKED_MALLOC_ZERO(interData->ref, int32_t, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir); CHECKED_MALLOC(interData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame); CHECKED_MALLOC(interData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame); - CHECKED_MALLOC(interData->partSize, uint8_t, analysis->numPartitions * analysis->numCUsInFrame); - CHECKED_MALLOC(interData->mergeFlag, uint8_t, analysis->numPartitions * analysis->numCUsInFrame); - CHECKED_MALLOC_ZERO(interData->wt, WeightParam, 3 * numDir); + if (m_param->analysisRefineLevel > 4) + { + CHECKED_MALLOC(interData->partSize, uint8_t, analysis->numPartitions * analysis->numCUsInFrame); + CHECKED_MALLOC(interData->mergeFlag, uint8_t, analysis->numPartitions * analysis->numCUsInFrame); + } + + if (m_param->analysisRefineLevel == 10) + { + CHECKED_MALLOC(interData->interDir, uint8_t, analysis->numPartitions * analysis->numCUsInFrame); + for (int dir = 0; dir < numDir; dir++) + { + CHECKED_MALLOC(interData->mvpIdx[dir], uint8_t, analysis->numPartitions * analysis->numCUsInFrame); + CHECKED_MALLOC(interData->refIdx[dir], int8_t, analysis->numPartitions * analysis->numCUsInFrame); + CHECKED_MALLOC(interData->mv[dir], MV, analysis->numPartitions * analysis->numCUsInFrame); + } + + /* Allocate intra in inter */ + if (analysis->sliceType == X265_TYPE_P || m_param->bIntraInBFrames) + { + analysis_intra_data *intraData = (analysis_intra_data*)analysis->intraData; + CHECKED_MALLOC_ZERO(intraData, analysis_intra_data, 1); + CHECKED_MALLOC(intraData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame); + CHECKED_MALLOC(intraData->chromaModes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame); + analysis->intraData = intraData; + } + } + else + CHECKED_MALLOC_ZERO(interData->ref, int32_t, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir); + analysis->interData = interData; } return; @@ -2332,22 +2477,53 @@ void Encoder::freeAnalysis(x265_analysis_data* analysis) { + /* Early exit freeing weights alone if level is 1 (when there is no analysis inter/intra) */ + if (analysis->sliceType > X265_TYPE_I && analysis->wt) + X265_FREE(analysis->wt); + if (m_param->analysisRefineLevel < 2) + return; + if (analysis->intraData) { + if (m_param->analysisRefineLevel < 2) + return; + X265_FREE(((analysis_intra_data*)analysis->intraData)->depth); X265_FREE(((analysis_intra_data*)analysis->intraData)->modes); X265_FREE(((analysis_intra_data*)analysis->intraData)->partSizes); X265_FREE(((analysis_intra_data*)analysis->intraData)->chromaModes); X265_FREE(analysis->intraData); } - else + else if (analysis->interData) { - X265_FREE(((analysis_inter_data*)analysis->interData)->ref); X265_FREE(((analysis_inter_data*)analysis->interData)->depth); X265_FREE(((analysis_inter_data*)analysis->interData)->modes); - X265_FREE(((analysis_inter_data*)analysis->interData)->mergeFlag); - X265_FREE(((analysis_inter_data*)analysis->interData)->partSize); - X265_FREE(((analysis_inter_data*)analysis->interData)->wt); + if (m_param->analysisRefineLevel > 4) + { + X265_FREE(((analysis_inter_data*)analysis->interData)->mergeFlag); + X265_FREE(((analysis_inter_data*)analysis->interData)->partSize); + } + + if (m_param->analysisRefineLevel == 10) + { + X265_FREE(((analysis_inter_data*)analysis->interData)->interDir); + int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2; + for (int dir = 0; dir < numDir; dir++) + { + X265_FREE(((analysis_inter_data*)analysis->interData)->mvpIdx[dir]); + X265_FREE(((analysis_inter_data*)analysis->interData)->refIdx[dir]); + X265_FREE(((analysis_inter_data*)analysis->interData)->mv[dir]); + } + if (analysis->sliceType == P_SLICE || m_param->bIntraInBFrames) + { + X265_FREE(((analysis_intra_data*)analysis->intraData)->modes); + X265_FREE(((analysis_intra_data*)analysis->intraData)->chromaModes); + X265_FREE(analysis->intraData); + } + } + else + X265_FREE(((analysis_inter_data*)analysis->interData)->ref); + X265_FREE(analysis->interData); } } @@ -2472,6 +2648,10 @@ if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I) { + analysis->sliceType = X265_TYPE_I; + if (m_param->analysisRefineLevel < 2) + return; + uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSizes = NULL; tempBuf = X265_MALLOC(uint8_t, depthBytes * 3); @@ -2492,21 +2672,55 @@ } X265_FREAD(((analysis_intra_data *)analysis->intraData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile); X265_FREE(tempBuf); - analysis->sliceType = X265_TYPE_I; consumedBytes += frameRecordSize; } else { + uint32_t numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2; + uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3; + X265_FREAD((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile); + if (m_param->analysisRefineLevel < 2) + return; + uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSize = NULL, *mergeFlag = NULL; + uint8_t *interDir = NULL, *chromaDir = NULL, *mvpIdx[2]; + MV* mv[2]; + int8_t* refIdx[2]; + + int numBuf = m_param->analysisRefineLevel > 4 ? 4 : 2; + bool bIntraInInter = false; + if (m_param->analysisRefineLevel == 10) + { + numBuf++; + bIntraInInter = (analysis->sliceType == X265_TYPE_P || m_param->bIntraInBFrames); + if (bIntraInInter) numBuf++; + } - tempBuf = X265_MALLOC(uint8_t, depthBytes * 4); - X265_FREAD(tempBuf, sizeof(uint8_t), depthBytes * 4, m_analysisFile); + tempBuf = X265_MALLOC(uint8_t, depthBytes * numBuf); + X265_FREAD(tempBuf, sizeof(uint8_t), depthBytes * numBuf, m_analysisFile); depthBuf = tempBuf; modeBuf = tempBuf + depthBytes; - partSize = modeBuf + depthBytes; - mergeFlag = partSize + depthBytes; + if (m_param->analysisRefineLevel > 4) + { + partSize = modeBuf + depthBytes; + mergeFlag = partSize + depthBytes; + if (m_param->analysisRefineLevel == 10) + { + interDir = mergeFlag + depthBytes; + if (bIntraInInter) chromaDir = interDir + depthBytes; + for (uint32_t i = 0; i < numDir; i++) + { + mvpIdx[i] = X265_MALLOC(uint8_t, depthBytes * 3); + X265_FREAD(mvpIdx[i], sizeof(uint8_t), depthBytes, m_analysisFile); + refIdx[i] = X265_MALLOC(int8_t, depthBytes); + X265_FREAD(refIdx[i], sizeof(int8_t), depthBytes, m_analysisFile); + mv[i] = X265_MALLOC(MV, depthBytes); + X265_FREAD(mv[i], sizeof(MV), depthBytes, m_analysisFile); + } + } + } size_t count = 0; for (uint32_t d = 0; d < depthBytes; d++) @@ -2514,17 +2728,47 @@ int bytes = analysis->numPartitions >> (depthBuf[d] * 2); memset(&((analysis_inter_data *)analysis->interData)->depth[count], depthBuf[d], bytes); memset(&((analysis_inter_data *)analysis->interData)->modes[count], modeBuf[d], bytes); - memset(&((analysis_inter_data *)analysis->interData)->partSize[count], partSize[d], bytes); - memset(&((analysis_inter_data *)analysis->interData)->mergeFlag[count], mergeFlag[d], bytes); + if (m_param->analysisRefineLevel > 4) + { + memset(&((analysis_inter_data *)analysis->interData)->partSize[count], partSize[d], bytes); + int numPU = nbPartsTable[(int)partSize[d]]; + for (int pu = 0; pu < numPU; pu++) + { + if (pu) d++; + ((analysis_inter_data *)analysis->interData)->mergeFlag[count + pu] = mergeFlag[d]; + if (m_param->analysisRefineLevel == 10) + { + ((analysis_inter_data *)analysis->interData)->interDir[count + pu] = interDir[d]; + for (uint32_t i = 0; i < numDir; i++) + { + ((analysis_inter_data *)analysis->interData)->mvpIdx[i][count + pu] = mvpIdx[i][d]; + ((analysis_inter_data *)analysis->interData)->refIdx[i][count + pu] = refIdx[i][d]; + memcpy(&((analysis_inter_data *)analysis->interData)->mv[i][count + pu], &mv[i][d], sizeof(MV)); + } + } + } + if (m_param->analysisRefineLevel == 10 && bIntraInInter) + memset(&((analysis_intra_data *)analysis->intraData)->chromaModes[count], chromaDir[d], bytes); + } count += bytes; } X265_FREE(tempBuf); - int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2; - X265_FREAD(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile); - uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3; - X265_FREAD(((analysis_inter_data *)analysis->interData)->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile); + if (m_param->analysisRefineLevel == 10) + { + for (uint32_t i = 0; i < numDir; i++) + { + X265_FREE(mvpIdx[i]); + X265_FREE(refIdx[i]); + X265_FREE(mv[i]); + } + if (bIntraInInter) + X265_FREAD(((analysis_intra_data *)analysis->intraData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile); + } + else + X265_FREAD(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile); + consumedBytes += frameRecordSize; if (numDir == 1) totalConsumedBytes = consumedBytes; @@ -2670,78 +2914,128 @@ }\ uint32_t depthBytes = 0; - if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I) + uint32_t numDir, numPlanes; + bool bIntraInInter = false; + + /* calculate frameRecordSize */ + analysis->frameRecordSize = sizeof(analysis->frameRecordSize) + sizeof(depthBytes) + sizeof(analysis->poc) + sizeof(analysis->sliceType) + + sizeof(analysis->numCUsInFrame) + sizeof(analysis->numPartitions) + sizeof(analysis->bScenecut) + sizeof(analysis->satdCost); + if (analysis->sliceType > X265_TYPE_I) { - for (uint32_t cuAddr = 0; cuAddr < analysis->numCUsInFrame; cuAddr++) + numDir = (analysis->sliceType == X265_TYPE_P) ? 1 : 2; + numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3; + analysis->frameRecordSize += sizeof(WeightParam) * numPlanes * numDir; + } + + if (m_param->analysisRefineLevel > 1) + { + if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I) { - uint8_t depth = 0; - uint8_t mode = 0; - uint8_t partSize = 0; + for (uint32_t cuAddr = 0; cuAddr < analysis->numCUsInFrame; cuAddr++) + { + uint8_t depth = 0; + uint8_t mode = 0; + uint8_t partSize = 0; - CUData* ctu = curEncData.getPicCTU(cuAddr); - analysis_intra_data* intraDataCTU = (analysis_intra_data*)analysis->intraData; + CUData* ctu = curEncData.getPicCTU(cuAddr); + analysis_intra_data* intraDataCTU = (analysis_intra_data*)analysis->intraData; - for (uint32_t absPartIdx = 0; absPartIdx < ctu->m_numPartitions; depthBytes++) - { - depth = ctu->m_cuDepth[absPartIdx]; - intraDataCTU->depth[depthBytes] = depth; + for (uint32_t absPartIdx = 0; absPartIdx < ctu->m_numPartitions; depthBytes++) + { + depth = ctu->m_cuDepth[absPartIdx]; + intraDataCTU->depth[depthBytes] = depth; - mode = ctu->m_chromaIntraDir[absPartIdx]; - intraDataCTU->chromaModes[depthBytes] = mode; + mode = ctu->m_chromaIntraDir[absPartIdx]; + intraDataCTU->chromaModes[depthBytes] = mode; - partSize = ctu->m_partSize[absPartIdx]; - intraDataCTU->partSizes[depthBytes] = partSize; + partSize = ctu->m_partSize[absPartIdx]; + intraDataCTU->partSizes[depthBytes] = partSize; - absPartIdx += ctu->m_numPartitions >> (depth * 2); + absPartIdx += ctu->m_numPartitions >> (depth * 2); + } + memcpy(&intraDataCTU->modes[ctu->m_cuAddr * ctu->m_numPartitions], ctu->m_lumaIntraDir, sizeof(uint8_t)* ctu->m_numPartitions); } - memcpy(&intraDataCTU->modes[ctu->m_cuAddr * ctu->m_numPartitions], ctu->m_lumaIntraDir, sizeof(uint8_t)* ctu->m_numPartitions); } - } - else - { - for (uint32_t cuAddr = 0; cuAddr < analysis->numCUsInFrame; cuAddr++) + else { - uint8_t depth = 0; - uint8_t predMode = 0; - uint8_t partSize = 0; - uint8_t mergeFlag = 0; - - CUData* ctu = curEncData.getPicCTU(cuAddr); - analysis_inter_data* interDataCTU = (analysis_inter_data*)analysis->interData; - - for (uint32_t absPartIdx = 0; absPartIdx < ctu->m_numPartitions; depthBytes++) + bIntraInInter = (analysis->sliceType == X265_TYPE_P || m_param->bIntraInBFrames); + for (uint32_t cuAddr = 0; cuAddr < analysis->numCUsInFrame; cuAddr++) { - depth = ctu->m_cuDepth[absPartIdx]; - interDataCTU->depth[depthBytes] = depth; + uint8_t depth = 0; + uint8_t predMode = 0; + uint8_t partSize = 0; + + CUData* ctu = curEncData.getPicCTU(cuAddr); + analysis_inter_data* interDataCTU = (analysis_inter_data*)analysis->interData; + analysis_intra_data* intraDataCTU = (analysis_intra_data*)analysis->intraData; - predMode = ctu->m_predMode[absPartIdx]; - if (ctu->m_refIdx[1][absPartIdx] != -1) - predMode = 4; // used as indiacator if the block is coded as bidir + for (uint32_t absPartIdx = 0; absPartIdx < ctu->m_numPartitions; depthBytes++) + { + depth = ctu->m_cuDepth[absPartIdx]; + interDataCTU->depth[depthBytes] = depth; - interDataCTU->modes[depthBytes] = predMode; + predMode = ctu->m_predMode[absPartIdx]; + if (m_param->analysisRefineLevel != 10 && ctu->m_refIdx[1][absPartIdx] != -1) + predMode = 4; // used as indiacator if the block is coded as bidir - partSize = ctu->m_partSize[absPartIdx]; - interDataCTU->partSize[depthBytes] = partSize; + interDataCTU->modes[depthBytes] = predMode; - mergeFlag = ctu->m_mergeFlag[absPartIdx]; - interDataCTU->mergeFlag[depthBytes] = mergeFlag; + if (m_param->analysisRefineLevel > 4) + { + partSize = ctu->m_partSize[absPartIdx]; + interDataCTU->partSize[depthBytes] = partSize; - absPartIdx += ctu->m_numPartitions >> (depth * 2); + /* Store per PU data */ + uint32_t numPU = nbPartsTable[(int)partSize]; + for (uint32_t puIdx = 0; puIdx < numPU; puIdx++) + { + uint32_t puabsPartIdx = ctu->getPUOffset(puIdx, absPartIdx) + absPartIdx; + if (puIdx) depthBytes++; + interDataCTU->mergeFlag[depthBytes] = ctu->m_mergeFlag[puabsPartIdx]; + + if (m_param->analysisRefineLevel == 10) + { + interDataCTU->interDir[depthBytes] = ctu->m_interDir[puabsPartIdx]; + for (uint32_t dir = 0; dir < numDir; dir++) + { + interDataCTU->mvpIdx[dir][depthBytes] = ctu->m_mvpIdx[dir][puabsPartIdx]; + interDataCTU->refIdx[dir][depthBytes] = ctu->m_refIdx[dir][puabsPartIdx]; + interDataCTU->mv[dir][depthBytes] = ctu->m_mv[dir][puabsPartIdx]; + } + } + } + if (m_param->analysisRefineLevel == 10 && bIntraInInter) + intraDataCTU->chromaModes[depthBytes] = ctu->m_chromaIntraDir[absPartIdx]; + } + absPartIdx += ctu->m_numPartitions >> (depth * 2); + } + if (m_param->analysisRefineLevel == 10 && bIntraInInter) + memcpy(&intraDataCTU->modes[ctu->m_cuAddr * ctu->m_numPartitions], ctu->m_lumaIntraDir, sizeof(uint8_t)* ctu->m_numPartitions); } } - } - /* calculate frameRecordSize */ - analysis->frameRecordSize = sizeof(analysis->frameRecordSize) + sizeof(depthBytes) + sizeof(analysis->poc) + sizeof(analysis->sliceType) + - sizeof(analysis->numCUsInFrame) + sizeof(analysis->numPartitions) + sizeof(analysis->bScenecut) + sizeof(analysis->satdCost); - if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I) - analysis->frameRecordSize += sizeof(uint8_t)* analysis->numCUsInFrame * analysis->numPartitions + depthBytes * 3; - else - { - int numDir = (analysis->sliceType == X265_TYPE_P) ? 1 : 2; - analysis->frameRecordSize += depthBytes * 4; - analysis->frameRecordSize += sizeof(int32_t)* analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir; - analysis->frameRecordSize += sizeof(WeightParam)* 3 * numDir; + if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I) + analysis->frameRecordSize += sizeof(uint8_t)* analysis->numCUsInFrame * analysis->numPartitions + depthBytes * 3; + else + { + /* Add sizeof depth, modes, partSize, mergeFlag */ + analysis->frameRecordSize += depthBytes * 2; + if (m_param->analysisRefineLevel > 4) + analysis->frameRecordSize += (depthBytes * 2); + + if (m_param->analysisRefineLevel == 10) + { + /* Add Size of interDir, mvpIdx, refIdx, mv, luma and chroma modes */ + analysis->frameRecordSize += depthBytes; + analysis->frameRecordSize += sizeof(uint8_t)* depthBytes * numDir; + analysis->frameRecordSize += sizeof(int8_t)* depthBytes * numDir; + analysis->frameRecordSize += sizeof(MV)* depthBytes * numDir; + if (bIntraInInter) + analysis->frameRecordSize += sizeof(uint8_t)* analysis->numCUsInFrame * analysis->numPartitions + depthBytes; + } + else + analysis->frameRecordSize += sizeof(int32_t)* analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir; + } } X265_FWRITE(&analysis->frameRecordSize, sizeof(uint32_t), 1, m_analysisFile); X265_FWRITE(&depthBytes, sizeof(uint32_t), 1, m_analysisFile); @@ -2751,6 +3045,11 @@ X265_FWRITE(&analysis->satdCost, sizeof(int64_t), 1, m_analysisFile); X265_FWRITE(&analysis->numCUsInFrame, sizeof(int), 1, m_analysisFile); X265_FWRITE(&analysis->numPartitions, sizeof(int), 1, m_analysisFile); + if (analysis->sliceType > X265_TYPE_I) + X265_FWRITE((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile); + + if (m_param->analysisRefineLevel < 2) + return; if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I) { @@ -2761,17 +3060,33 @@ } else { - int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2; X265_FWRITE(((analysis_inter_data*)analysis->interData)->depth, sizeof(uint8_t), depthBytes, m_analysisFile); X265_FWRITE(((analysis_inter_data*)analysis->interData)->modes, sizeof(uint8_t), depthBytes, m_analysisFile); - X265_FWRITE(((analysis_inter_data*)analysis->interData)->partSize, sizeof(uint8_t), depthBytes, m_analysisFile); - X265_FWRITE(((analysis_inter_data*)analysis->interData)->mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFile); - X265_FWRITE(((analysis_inter_data*)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile); - uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3; - X265_FWRITE(((analysis_inter_data*)analysis->interData)->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile); + if (m_param->analysisRefineLevel > 4) + { + X265_FWRITE(((analysis_inter_data*)analysis->interData)->partSize, sizeof(uint8_t), depthBytes, m_analysisFile); + X265_FWRITE(((analysis_inter_data*)analysis->interData)->mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFile); + if (m_param->analysisRefineLevel == 10) + { + X265_FWRITE(((analysis_inter_data*)analysis->interData)->interDir, sizeof(uint8_t), depthBytes, m_analysisFile); + if (bIntraInInter) X265_FWRITE(((analysis_intra_data*)analysis->intraData)->chromaModes, sizeof(uint8_t), depthBytes, m_analysisFile); + for (uint32_t dir = 0; dir < numDir; dir++) + { + X265_FWRITE(((analysis_inter_data*)analysis->interData)->mvpIdx[dir], sizeof(uint8_t), depthBytes, m_analysisFile); + X265_FWRITE(((analysis_inter_data*)analysis->interData)->refIdx[dir], sizeof(int8_t), depthBytes, m_analysisFile); + X265_FWRITE(((analysis_inter_data*)analysis->interData)->mv[dir], sizeof(MV), depthBytes, m_analysisFile); + } + if (bIntraInInter) + X265_FWRITE(((analysis_intra_data*)analysis->intraData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile); + } + } + if (m_param->analysisRefineLevel != 10) + X265_FWRITE(((analysis_inter_data*)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile); + } #undef X265_FWRITE } + void Encoder::writeAnalysis2PassFile(x265_analysis_2Pass* analysis2Pass, FrameData &curEncData, int slicetype) { #define X265_FWRITE(val, size, writeSize, fileOffset)\ @@ -2870,7 +3185,7 @@ void Encoder::printReconfigureParams() { - if (!m_reconfigure) + if (!(m_reconfigure || m_reconfigureRc)) return; x265_param* oldParam = m_param; x265_param* newParam = m_latestParam; @@ -2892,6 +3207,10 @@ TOOLCMP(oldParam->maxNumMergeCand, newParam->maxNumMergeCand, "max-merge=%d to %d\n"); TOOLCMP(oldParam->bIntraInBFrames, newParam->bIntraInBFrames, "b-intra=%d to %d\n"); TOOLCMP(oldParam->scalingLists, newParam->scalingLists, "scalinglists=%s to %s\n"); + TOOLCMP(oldParam->rc.vbvMaxBitrate, newParam->rc.vbvMaxBitrate, "vbv-maxrate=%d to %d\n"); + TOOLCMP(oldParam->rc.vbvBufferSize, newParam->rc.vbvBufferSize, "vbv-bufsize=%d to %d\n"); + TOOLCMP(oldParam->rc.bitrate, newParam->rc.bitrate, "bitrate=%d to %d\n"); + TOOLCMP(oldParam->rc.rfConstant, newParam->rc.rfConstant, "crf=%f to %f\n"); } bool Encoder::computeSPSRPSIndex()
View file
x265_2.3.tar.gz/source/encoder/encoder.h -> x265_2.4.tar.gz/source/encoder/encoder.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * @@ -32,8 +32,11 @@ #include "nal.h" #include "framedata.h" -struct x265_encoder {}; +#ifdef ENABLE_DYNAMIC_HDR10 + #include "dynamicHDR10\hdr10plus.h" +#endif +struct x265_encoder {}; namespace X265_NS { // private namespace extern const char g_sliceTypeToChar[3]; @@ -153,6 +156,7 @@ bool m_bZeroLatency; // x265_encoder_encode() returns NALs for the input picture, zero lag bool m_aborted; // fatal error detected bool m_reconfigure; // Encoder reconfigure in progress + bool m_reconfigureRc; /* Begin intra refresh when one not in progress or else begin one as soon as the current * one is done. Requires bIntraRefresh to be set.*/ @@ -168,9 +172,26 @@ Lock m_rpsInSpsLock; int m_rpsInSpsCount; + /* For HDR*/ + double m_cB; + double m_cR; + + int m_bToneMap; // Enables tone-mapping + +#ifdef ENABLE_DYNAMIC_HDR10 + const hdr10plus_api *m_hdr10plus_api; +#endif + + x265_sei_payload m_prevTonemapPayload; Encoder(); - ~Encoder() {} + ~Encoder() + { +#ifdef ENABLE_DYNAMIC_HDR10 + if (m_prevTonemapPayload.payload != NULL) + X265_FREE(m_prevTonemapPayload.payload); +#endif + }; void create(); void stopJobs();
View file
x265_2.3.tar.gz/source/encoder/entropy.cpp -> x265_2.4.tar.gz/source/encoder/entropy.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -349,7 +349,7 @@ WRITE_SVLC(pps.chromaQpOffset[0], "pps_cb_qp_offset"); WRITE_SVLC(pps.chromaQpOffset[1], "pps_cr_qp_offset"); - WRITE_FLAG(0, "pps_slice_chroma_qp_offsets_present_flag"); + WRITE_FLAG(pps.pps_slice_chroma_qp_offsets_present_flag, "pps_slice_chroma_qp_offsets_present_flag"); WRITE_FLAG(pps.bUseWeightPred, "weighted_pred_flag"); WRITE_FLAG(pps.bUseWeightedBiPred, "weighted_bipred_flag"); @@ -692,6 +692,11 @@ int code = sliceQp - (slice.m_iPPSQpMinus26 + 26); WRITE_SVLC(code, "slice_qp_delta"); + if (slice.m_pps->pps_slice_chroma_qp_offsets_present_flag) + { + WRITE_SVLC(slice.m_chromaQpOffset[0], "slice_cb_qp_offset"); + WRITE_SVLC(slice.m_chromaQpOffset[1], "slice_cr_qp_offset"); + } // TODO: Enable when pps_loop_filter_across_slices_enabled_flag==1 // We didn't support filter across slice board, so disable it now
View file
x265_2.3.tar.gz/source/encoder/entropy.h -> x265_2.4.tar.gz/source/encoder/entropy.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/frameencoder.cpp -> x265_2.4.tar.gz/source/encoder/frameencoder.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Chung Shin Yee <shinyee@multicorewareinc.com> * Min Chen <chenm003@163.com> @@ -384,7 +384,7 @@ WeightParam* reuseWP = NULL; if (m_param->analysisMode && (bUseWeightP || bUseWeightB)) - reuseWP = ((analysis_inter_data*)m_frame->m_analysisData.interData)->wt; + reuseWP = (WeightParam*)m_frame->m_analysisData.wt; if (bUseWeightP || bUseWeightB) { @@ -448,6 +448,40 @@ /* Get the QP for this frame from rate control. This call may block until * frames ahead of it in encode order have called rateControlEnd() */ m_rce.encodeOrder = m_frame->m_encodeOrder; + bool payloadChange = false; + bool writeSei = true; + if (m_param->bDhdr10opt) + { + for (int i = 0; i < m_frame->m_userSEI.numPayloads; i++) + { + x265_sei_payload *payload = &m_frame->m_userSEI.payloads[i]; + if(payload->payloadType == USER_DATA_REGISTERED_ITU_T_T35) + { + if (m_top->m_prevTonemapPayload.payload != NULL && payload->payloadSize == m_top->m_prevTonemapPayload.payloadSize) + { + if (memcmp(m_top->m_prevTonemapPayload.payload, payload->payload, payload->payloadSize) != 0) + payloadChange = true; + } + else + { + payloadChange = true; + if (m_top->m_prevTonemapPayload.payload != NULL) + x265_free(m_top->m_prevTonemapPayload.payload); + m_top->m_prevTonemapPayload.payload = (uint8_t*)x265_malloc(sizeof(uint8_t) * payload->payloadSize); + } + + if (payloadChange) + { + m_top->m_prevTonemapPayload.payloadType = payload->payloadType; + m_top->m_prevTonemapPayload.payloadSize = payload->payloadSize; + memcpy(m_top->m_prevTonemapPayload.payload, payload->payload, payload->payloadSize); + } + + bool isIDR = m_frame->m_lowres.sliceType == X265_TYPE_IDR; + writeSei = payloadChange || isIDR; + } + } + } int qp = m_top->m_rateControl->rateControlStart(m_frame, &m_rce, m_top); m_rce.newQp = qp; @@ -483,6 +517,13 @@ /* Clip slice QP to 0-51 spec range before encoding */ slice->m_sliceQp = x265_clip3(-QP_BD_OFFSET, QP_MAX_SPEC, qp); + if (m_param->bHDROpt) + { + int qpCb = x265_clip3(-12, 0, (int)floor((m_top->m_cB * ((-.46) * qp + 9.26)) + 0.5 )); + int qpCr = x265_clip3(-12, 0, (int)floor((m_top->m_cR * ((-.46) * qp + 9.26)) + 0.5 )); + slice->m_chromaQpOffset[0] = slice->m_pps->chromaQpOffset[0] + qpCb < -12 ? (qpCb + (-12 - (slice->m_pps->chromaQpOffset[0] + qpCb))) : qpCb; + slice->m_chromaQpOffset[1] = slice->m_pps->chromaQpOffset[1] + qpCr < -12 ? (qpCr + (-12 - (slice->m_pps->chromaQpOffset[1] + qpCr))) : qpCr; + } if (m_param->bOptQpPPS && m_param->bRepeatHeaders) { @@ -608,18 +649,32 @@ for (int i = 0; i < m_frame->m_userSEI.numPayloads; i++) { x265_sei_payload *payload = &m_frame->m_userSEI.payloads[i]; - SEIuserDataUnregistered sei; - - sei.m_payloadType = payload->payloadType; - sei.m_userDataLength = payload->payloadSize; - sei.m_userData = payload->payload; - - m_bs.resetBits(); - sei.write(m_bs, *slice->m_sps); - m_bs.writeByteAlignment(); - m_nalList.serialize(NAL_UNIT_PREFIX_SEI, m_bs); + if (payload->payloadType == USER_DATA_UNREGISTERED) + { + SEIuserDataUnregistered sei; + sei.m_userData = payload->payload; + m_bs.resetBits(); + sei.setSize(payload->payloadSize); + sei.write(m_bs, *slice->m_sps); + m_bs.writeByteAlignment(); + m_nalList.serialize(NAL_UNIT_PREFIX_SEI, m_bs); + } + else if (payload->payloadType == USER_DATA_REGISTERED_ITU_T_T35) + { + if (writeSei) + { + SEICreativeIntentMeta sei; + sei.cim = payload->payload; + m_bs.resetBits(); + sei.setSize(payload->payloadSize); + sei.write(m_bs, *slice->m_sps); + m_bs.writeByteAlignment(); + m_nalList.serialize(NAL_UNIT_PREFIX_SEI, m_bs); + } + } + else + x265_log(m_param, X265_LOG_ERROR, "Unrecognized SEI type\n"); } - /* CQP and CRF (without capped VBV) doesn't use mid-frame statistics to * tune RateControl parameters for other frames. * Hence, for these modes, update m_startEndOrder and unlock RC for previous threads waiting in @@ -928,29 +983,32 @@ if (m_param->decodedPictureHashSEI) { int planes = (m_frame->m_param->internalCsp != X265_CSP_I400) ? 3 : 1; + int32_t payloadSize = 0; if (m_param->decodedPictureHashSEI == 1) { m_seiReconPictureDigest.m_method = SEIDecodedPictureHash::MD5; for (int i = 0; i < planes; i++) MD5Final(&m_state[i], m_seiReconPictureDigest.m_digest[i]); + payloadSize = 1 + 16 * planes; } else if (m_param->decodedPictureHashSEI == 2) { m_seiReconPictureDigest.m_method = SEIDecodedPictureHash::CRC; for (int i = 0; i < planes; i++) crcFinish(m_crc[i], m_seiReconPictureDigest.m_digest[i]); + payloadSize = 1 + 2 * planes; } else if (m_param->decodedPictureHashSEI == 3) { m_seiReconPictureDigest.m_method = SEIDecodedPictureHash::CHECKSUM; for (int i = 0; i < planes; i++) checksumFinish(m_checksum[i], m_seiReconPictureDigest.m_digest[i]); + payloadSize = 1 + 4 * planes; } - m_bs.resetBits(); + m_seiReconPictureDigest.setSize(payloadSize); m_seiReconPictureDigest.write(m_bs, *slice->m_sps); m_bs.writeByteAlignment(); - m_nalList.serialize(NAL_UNIT_SUFFIX_SEI, m_bs); } @@ -1328,11 +1386,6 @@ rowCoder.copyState(m_initSliceContext); rowCoder.loadContexts(m_rows[row - 1].bufferedEntropy); } - analysis2PassFrameData* analysisFrameData = (analysis2PassFrameData*)(m_frame->m_analysis2Pass).analysisFramedata; - if (analysisFrameData && m_param->rc.bStatRead && m_param->analysisMultiPassDistortion && (analysisFrameData->threshold[cuAddr] < 0.9 || analysisFrameData->threshold[cuAddr] > 1.1) - && analysisFrameData->highDistortionCtuCount && analysisFrameData->lowDistortionCtuCount) - curEncData.m_cuStat[cuAddr].baseQp += analysisFrameData->offset[cuAddr]; - if (m_param->dynamicRd && (int32_t)(m_rce.qpaRc - m_rce.qpNoVbv) > 0) ctu->m_vbvAffected = true;
View file
x265_2.3.tar.gz/source/encoder/frameencoder.h -> x265_2.4.tar.gz/source/encoder/frameencoder.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Shin Yee <shinyee@multicorewareinc.com> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/framefilter.cpp -> x265_2.4.tar.gz/source/encoder/framefilter.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Chung Shin Yee <shinyee@multicorewareinc.com> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/framefilter.h -> x265_2.4.tar.gz/source/encoder/framefilter.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Chung Shin Yee <shinyee@multicorewareinc.com> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/level.cpp -> x265_2.4.tar.gz/source/encoder/level.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/level.h -> x265_2.4.tar.gz/source/encoder/level.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/encoder/motion.cpp -> x265_2.4.tar.gz/source/encoder/motion.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/motion.h -> x265_2.4.tar.gz/source/encoder/motion.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/nal.cpp -> x265_2.4.tar.gz/source/encoder/nal.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/nal.h -> x265_2.4.tar.gz/source/encoder/nal.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/encoder/ratecontrol.cpp -> x265_2.4.tar.gz/source/encoder/ratecontrol.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Sumalatha Polureddy <sumalatha@multicorewareinc.com> * Aarthi Priya Thirumalai <aarthi@multicorewareinc.com> @@ -683,6 +683,56 @@ return true; } +void RateControl::reconfigureRC() +{ + if (m_isVbv) + { + m_param->rc.vbvBufferSize = x265_clip3(0, 2000000, m_param->rc.vbvBufferSize); + m_param->rc.vbvMaxBitrate = x265_clip3(0, 2000000, m_param->rc.vbvMaxBitrate); + if (m_param->rc.vbvMaxBitrate < m_param->rc.bitrate && + m_param->rc.rateControlMode == X265_RC_ABR) + { + x265_log(m_param, X265_LOG_WARNING, "max bitrate less than average bitrate, assuming CBR\n"); + m_param->rc.bitrate = m_param->rc.vbvMaxBitrate; + } + + if (m_param->rc.vbvBufferSize < (int)(m_param->rc.vbvMaxBitrate / m_fps)) + { + m_param->rc.vbvBufferSize = (int)(m_param->rc.vbvMaxBitrate / m_fps); + x265_log(m_param, X265_LOG_WARNING, "VBV buffer size cannot be smaller than one frame, using %d kbit\n", + m_param->rc.vbvBufferSize); + } + int vbvBufferSize = m_param->rc.vbvBufferSize * 1000; + int vbvMaxBitrate = m_param->rc.vbvMaxBitrate * 1000; + m_bufferRate = vbvMaxBitrate / m_fps; + m_vbvMaxRate = vbvMaxBitrate; + m_bufferSize = vbvBufferSize; + m_singleFrameVbv = m_bufferRate * 1.1 > m_bufferSize; + } + if (m_param->rc.rateControlMode == X265_RC_CRF) + { + #define CRF_INIT_QP (int)m_param->rc.rfConstant + m_param->rc.bitrate = 0; + double baseCplx = m_ncu * (m_param->bframes ? 120 : 80); + double mbtree_offset = m_param->rc.cuTree ? (1.0 - m_param->rc.qCompress) * 13.5 : 0; + m_rateFactorConstant = pow(baseCplx, 1 - m_qCompress) / + x265_qp2qScale(m_param->rc.rfConstant + mbtree_offset); + if (m_param->rc.rfConstantMax) + { + m_rateFactorMaxIncrement = m_param->rc.rfConstantMax - m_param->rc.rfConstant; + if (m_rateFactorMaxIncrement <= 0) + { + x265_log(m_param, X265_LOG_WARNING, "CRF max must be greater than CRF\n"); + m_rateFactorMaxIncrement = 0; + } + } + if (m_param->rc.rfConstantMin) + m_rateFactorMaxDecrement = m_param->rc.rfConstant - m_param->rc.rfConstantMin; + } + m_bitrate = m_param->rc.bitrate * 1000; +} + + void RateControl::initHRD(SPS& sps) { int vbvBufferSize = m_param->rc.vbvBufferSize * 1000; @@ -1298,6 +1348,8 @@ curFrame->m_rcData->cumulativePNorm = m_accumPNorm; for (int i = 0; i < 3; i++) curFrame->m_rcData->lastQScaleFor[i] = m_lastQScaleFor[i]; + curFrame->m_rcData->shortTermCplxSum = m_shortTermCplxSum; + curFrame->m_rcData->shortTermCplxCount = m_shortTermCplxCount; } else // CQP { @@ -1896,20 +1948,20 @@ else if (m_framesDone == 0 && !m_isVbv && m_param->rc.rateControlMode == X265_RC_ABR) { /* for ABR alone, clip the first I frame qp */ - lqmax = (m_lstep * m_isGrainEnabled) ? x265_qp2qScale(ABR_INIT_QP_GRAIN_MAX) : + lqmax = (m_isGrainEnabled && m_lstep) ? x265_qp2qScale(ABR_INIT_QP_GRAIN_MAX) : x265_qp2qScale(ABR_INIT_QP_MAX); - q = X265_MIN(lqmax, q); + q = X265_MIN(lqmax, q); } q = x265_clip3(lqmin, lqmax, q); /* Set a min qp at scenechanges and transitions */ if (m_isSceneTransition) { - double minScenecutQscale =x265_qp2qScale(ABR_SCENECUT_INIT_QP_MIN); - q = X265_MAX(minScenecutQscale, q); - m_lastQScaleFor[P_SLICE] = X265_MAX(minScenecutQscale, m_lastQScaleFor[P_SLICE]); + double minScenecutQscale = x265_qp2qScale(ABR_SCENECUT_INIT_QP_MIN); + q = X265_MAX(minScenecutQscale, q); + m_lastQScaleFor[P_SLICE] = X265_MAX(minScenecutQscale, m_lastQScaleFor[P_SLICE]); } rce->qpNoVbv = x265_qScale2qp(q); - if(m_sliceType == P_SLICE) + if (m_sliceType == P_SLICE) { m_avgPFrameQp = m_avgPFrameQp == 0 ? rce->qpNoVbv : m_avgPFrameQp; m_avgPFrameQp = (m_avgPFrameQp + rce->qpNoVbv) / 2; @@ -2498,25 +2550,25 @@ m_bufferFillFinal = X265_MAX(m_bufferFillFinal, 0); m_bufferFillFinal += m_bufferRate; - if (m_bufferFillFinal > m_bufferSize) + if (m_param->rc.bStrictCbr) { - if (m_param->rc.bStrictCbr) + if (m_bufferFillFinal > m_bufferSize) { filler = (int)(m_bufferFillFinal - m_bufferSize); filler += FILLER_OVERHEAD * 8; - m_bufferFillFinal -= filler; - bufferBits = X265_MIN(bits + filler + m_bufferExcess, m_bufferRate); - m_bufferExcess = X265_MAX(m_bufferExcess - bufferBits + bits + filler, 0); - m_bufferFillActual += bufferBits - bits - filler; - } - else - { - m_bufferFillFinal = X265_MIN(m_bufferFillFinal, m_bufferSize); - bufferBits = X265_MIN(bits + m_bufferExcess, m_bufferRate); - m_bufferExcess = X265_MAX(m_bufferExcess - bufferBits + bits, 0); - m_bufferFillActual += bufferBits - bits; - m_bufferFillActual = X265_MIN(m_bufferFillActual, m_bufferSize); } + m_bufferFillFinal -= filler; + bufferBits = X265_MIN(bits + filler + m_bufferExcess, m_bufferRate); + m_bufferExcess = X265_MAX(m_bufferExcess - bufferBits + bits + filler, 0); + m_bufferFillActual += bufferBits - bits - filler; + } + else + { + m_bufferFillFinal = X265_MIN(m_bufferFillFinal, m_bufferSize); + bufferBits = X265_MIN(bits + m_bufferExcess, m_bufferRate); + m_bufferExcess = X265_MAX(m_bufferExcess - bufferBits + bits, 0); + m_bufferFillActual += bufferBits - bits; + m_bufferFillActual = X265_MIN(m_bufferFillActual, m_bufferSize); } return filler; } @@ -2643,6 +2695,10 @@ int qp = int (rce->qpaRc + 0.5); m_qpToEncodedBits[qp] = m_qpToEncodedBits[qp] == 0 ? actualBits : (m_qpToEncodedBits[qp] + actualBits) * 0.5; } + curFrame->m_rcData->wantedBitsWindow = m_wantedBitsWindow; + curFrame->m_rcData->cplxrSum = m_cplxrSum; + curFrame->m_rcData->totalBits = m_totalBits; + curFrame->m_rcData->encodedBits = m_encodedBits; } if (m_2pass)
View file
x265_2.3.tar.gz/source/encoder/ratecontrol.h -> x265_2.4.tar.gz/source/encoder/ratecontrol.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Sumalatha Polureddy <sumalatha@multicorewareinc.com> * Aarthi Priya Thirumalai <aarthi@multicorewareinc.com> @@ -234,6 +234,7 @@ RateControl(x265_param& p); bool init(const SPS& sps); void initHRD(SPS& sps); + void reconfigureRC(); void setFinalFrameCount(int count); void terminate(); /* un-block all waiting functions so encoder may close */
View file
x265_2.3.tar.gz/source/encoder/rdcost.h -> x265_2.4.tar.gz/source/encoder/rdcost.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -67,13 +67,13 @@ int qpCb, qpCr; if (slice.m_sps->chromaFormatIdc == X265_CSP_I420) { - qpCb = (int)g_chromaScale[x265_clip3(QP_MIN, QP_MAX_MAX, qp + slice.m_pps->chromaQpOffset[0])]; - qpCr = (int)g_chromaScale[x265_clip3(QP_MIN, QP_MAX_MAX, qp + slice.m_pps->chromaQpOffset[1])]; + qpCb = (int)g_chromaScale[x265_clip3(QP_MIN, QP_MAX_MAX, qp + slice.m_pps->chromaQpOffset[0] + slice.m_chromaQpOffset[0])]; + qpCr = (int)g_chromaScale[x265_clip3(QP_MIN, QP_MAX_MAX, qp + slice.m_pps->chromaQpOffset[1] + slice.m_chromaQpOffset[1])]; } else { - qpCb = x265_clip3(QP_MIN, QP_MAX_SPEC, qp + slice.m_pps->chromaQpOffset[0]); - qpCr = x265_clip3(QP_MIN, QP_MAX_SPEC, qp + slice.m_pps->chromaQpOffset[1]); + qpCb = x265_clip3(QP_MIN, QP_MAX_SPEC, qp + slice.m_pps->chromaQpOffset[0] + slice.m_chromaQpOffset[0]); + qpCr = x265_clip3(QP_MIN, QP_MAX_SPEC, qp + slice.m_pps->chromaQpOffset[1] + slice.m_chromaQpOffset[1]); } if (slice.m_sps->chromaFormatIdc == X265_CSP_I444)
View file
x265_2.3.tar.gz/source/encoder/reference.cpp -> x265_2.4.tar.gz/source/encoder/reference.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Deepthi Devaki <deepthidevaki@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/encoder/reference.h -> x265_2.4.tar.gz/source/encoder/reference.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/sao.cpp -> x265_2.4.tar.gz/source/encoder/sao.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -734,6 +734,7 @@ /* Calculate SAO statistics for current CTU without non-crossing slice */ void SAO::calcSaoStatsCTU(int addr, int plane) { + Slice* slice = m_frame->m_encData->m_slice; const PicYuv* reconPic = m_frame->m_reconPic; const CUData* cu = m_frame->m_encData->getPicCTU(addr); const pixel* fenc0 = m_frame->m_fencPic->getPlaneAddr(plane, addr); @@ -857,60 +858,60 @@ primitives.saoCuStatsE1(diff + startY * MAX_CU_SIZE, rec0 + startY * stride, stride, upBuff1, endX, endY - startY, m_offsetOrg[plane][SAO_EO_1], m_count[plane][SAO_EO_1]); } - - // SAO_EO_2: // dir: 135 + if (!m_param->bLimitSAO || ((slice->m_sliceType == P_SLICE && !cu->isSkipped(0)) || + (slice->m_sliceType != B_SLICE))) { - if (m_param->bSaoNonDeblocked) + // SAO_EO_2: // dir: 135 { - skipB = 4; - skipR = 5; - } + if (m_param->bSaoNonDeblocked) + { + skipB = 4; + skipR = 5; + } - fenc = fenc0; - rec = rec0; + fenc = fenc0; + rec = rec0; - startX = !lpelx; - endX = (rpelx == picWidth) ? ctuWidth - 1 : ctuWidth - skipR + plane_offset; + startX = !lpelx; + endX = (rpelx == picWidth) ? ctuWidth - 1 : ctuWidth - skipR + plane_offset; - startY = bAboveUnavail; - endY = (bpely == picHeight) ? ctuHeight - 1 : ctuHeight - skipB + plane_offset; - if (startY) - { - fenc += stride; - rec += stride; - } - - primitives.sign(upBuff1, &rec[startX], &rec[startX - stride - 1], (endX - startX)); + startY = bAboveUnavail; + endY = (bpely == picHeight) ? ctuHeight - 1 : ctuHeight - skipB + plane_offset; + if (startY) + { + fenc += stride; + rec += stride; + } - primitives.saoCuStatsE2(diff + startX + startY * MAX_CU_SIZE, rec0 + startX + startY * stride, stride, upBuff1, upBufft, endX - startX, endY - startY, m_offsetOrg[plane][SAO_EO_2], m_count[plane][SAO_EO_2]); - } + primitives.sign(upBuff1, &rec[startX], &rec[startX - stride - 1], (endX - startX)); - // SAO_EO_3: // dir: 45 - { - if (m_param->bSaoNonDeblocked) - { - skipB = 4; - skipR = 5; + primitives.saoCuStatsE2(diff + startX + startY * MAX_CU_SIZE, rec0 + startX + startY * stride, stride, upBuff1, upBufft, endX - startX, endY - startY, m_offsetOrg[plane][SAO_EO_2], m_count[plane][SAO_EO_2]); } + // SAO_EO_3: // dir: 45 + { + if (m_param->bSaoNonDeblocked) + { + skipB = 4; + skipR = 5; + } + fenc = fenc0; + rec = rec0; + startX = !lpelx; + endX = (rpelx == picWidth) ? ctuWidth - 1 : ctuWidth - skipR + plane_offset; - fenc = fenc0; - rec = rec0; + startY = bAboveUnavail; + endY = (bpely == picHeight) ? ctuHeight - 1 : ctuHeight - skipB + plane_offset; - startX = !lpelx; - endX = (rpelx == picWidth) ? ctuWidth - 1 : ctuWidth - skipR + plane_offset; + if (startY) + { + fenc += stride; + rec += stride; + } - startY = bAboveUnavail; - endY = (bpely == picHeight) ? ctuHeight - 1 : ctuHeight - skipB + plane_offset; + primitives.sign(upBuff1, &rec[startX - 1], &rec[startX - 1 - stride + 1], (endX - startX + 1)); - if (startY) - { - fenc += stride; - rec += stride; + primitives.saoCuStatsE3(diff + startX + startY * MAX_CU_SIZE, rec0 + startX + startY * stride, stride, upBuff1 + 1, endX - startX, endY - startY, m_offsetOrg[plane][SAO_EO_3], m_count[plane][SAO_EO_3]); } - - primitives.sign(upBuff1, &rec[startX - 1], &rec[startX - 1 - stride + 1], (endX - startX + 1)); - - primitives.saoCuStatsE3(diff + startX + startY * MAX_CU_SIZE, rec0 + startX + startY * stride, stride, upBuff1 + 1, endX - startX, endY - startY, m_offsetOrg[plane][SAO_EO_3], m_count[plane][SAO_EO_3]); } } } @@ -1224,18 +1225,15 @@ void SAO::rdoSaoUnitCu(SAOParam* saoParam, int rowBaseAddr, int idxX, int addr) { Slice* slice = m_frame->m_encData->m_slice; -// int qp = slice->m_sliceQp; const CUData* cu = m_frame->m_encData->getPicCTU(addr); int qp = cu->m_qp[0]; - int64_t lambda[2] = { 0 }; - int qpCb = qp; + int qpCb = qp + slice->m_pps->chromaQpOffset[0] + slice->m_chromaQpOffset[0]; if (m_param->internalCsp == X265_CSP_I420) - qpCb = x265_clip3(m_param->rc.qpMin, m_param->rc.qpMax, (int)g_chromaScale[qp + slice->m_pps->chromaQpOffset[0]]); + qpCb = x265_clip3(m_param->rc.qpMin, m_param->rc.qpMax, (int)g_chromaScale[x265_clip3(QP_MIN, QP_MAX_MAX, qpCb)]); else - qpCb = X265_MIN(qp + slice->m_pps->chromaQpOffset[0], QP_MAX_SPEC); - + qpCb = x265_clip3(m_param->rc.qpMin, m_param->rc.qpMax, qpCb); lambda[0] = (int64_t)floor(256.0 * x265_lambda2_tab[qp]); lambda[1] = (int64_t)floor(256.0 * x265_lambda2_tab[qpCb]); // Use Cb QP for SAO chroma @@ -1263,18 +1261,6 @@ for (int i = 0; i < planes; i++) saoParam->ctuParam[i][addr].reset(); - - if (saoParam->bSaoFlag[0]) - calcSaoStatsCTU(addr, 0); - - if (saoParam->bSaoFlag[1]) - { - calcSaoStatsCTU(addr, 1); - calcSaoStatsCTU(addr, 2); - } - - saoStatsInitialOffset(planes); - // SAO distortion calculation m_entropyCoder.load(m_rdContexts.cur); m_entropyCoder.resetBits(); @@ -1283,15 +1269,44 @@ if (allowMerge[1]) m_entropyCoder.codeSaoMerge(0); m_entropyCoder.store(m_rdContexts.temp); - - // Estimate distortion and cost of new SAO params + memset(m_offset, 0, sizeof(m_offset)); int64_t bestCost = 0; int64_t rateDist = 0; + + bool bAboveLeftAvail = true; + for (int mergeIdx = 0; mergeIdx < 2; ++mergeIdx) + { + if (!allowMerge[mergeIdx]) + continue; + + SaoCtuParam* mergeSrcParam = &(saoParam->ctuParam[0][addrMerge[mergeIdx]]); + bAboveLeftAvail = bAboveLeftAvail && (mergeSrcParam->typeIdx == -1); + } + // Don't apply sao if ctu is skipped or ajacent ctus are sao off + bool bSaoOff = (slice->m_sliceType == B_SLICE) && (cu->isSkipped(0) || bAboveLeftAvail); + // Estimate distortion and cost of new SAO params - saoLumaComponentParamDist(saoParam, addr, rateDist, lambda, bestCost); - if (chroma) - saoChromaComponentParamDist(saoParam, addr, rateDist, lambda, bestCost); + if (saoParam->bSaoFlag[0]) + { + if (!m_param->bLimitSAO || !bSaoOff) + { + calcSaoStatsCTU(addr, 0); + saoStatsInitialOffset(addr, 0); + saoLumaComponentParamDist(saoParam, addr, rateDist, lambda, bestCost); + } + } + SaoCtuParam* lclCtuParam = &saoParam->ctuParam[0][addr]; + if (saoParam->bSaoFlag[1]) + { + if (!m_param->bLimitSAO || ((lclCtuParam->typeIdx != -1) && !bSaoOff)) + { + calcSaoStatsCTU(addr, 1); + calcSaoStatsCTU(addr, 2); + saoStatsInitialOffset(addr, 1); + saoChromaComponentParamDist(saoParam, addr, rateDist, lambda, bestCost); + } + } if (saoParam->bSaoFlag[0] || saoParam->bSaoFlag[1]) { // Cost of merge left or Up @@ -1358,17 +1373,27 @@ } } - // Rounds the division of initial offsets by the number of samples in // each of the statistics table entries. -void SAO::saoStatsInitialOffset(int planes) +void SAO::saoStatsInitialOffset(int addr, int planes) { - memset(m_offset, 0, sizeof(m_offset)); + Slice* slice = m_frame->m_encData->m_slice; + const CUData* cu = m_frame->m_encData->getPicCTU(addr); + int maxSaoType; + if (m_param->bLimitSAO && ((slice->m_sliceType == P_SLICE && cu->isSkipped(0)) || + (slice->m_sliceType == B_SLICE))) + { + maxSaoType = MAX_NUM_SAO_TYPE - 3; + } + else + { + maxSaoType = MAX_NUM_SAO_TYPE - 1; + } // EO - for (int plane = 0; plane < planes; plane++) + for (int plane = planes; plane <= planes * 2; plane++) { - for (int typeIdx = 0; typeIdx < MAX_NUM_SAO_TYPE - 1; typeIdx++) + for (int typeIdx = 0; typeIdx < maxSaoType; typeIdx++) { for (int classIdx = 1; classIdx < SAO_NUM_OFFSET + 1; classIdx++) { @@ -1389,9 +1414,8 @@ } } } - // BO - for (int plane = 0; plane < planes; plane++) + for (int plane = planes; plane <= planes * 2; plane++) { for (int classIdx = 0; classIdx < MAX_NUM_SAO_CLASS; classIdx++) { @@ -1452,12 +1476,12 @@ costClasses = bestCost; offset = bestOffset; } - void SAO::saoLumaComponentParamDist(SAOParam* saoParam, int32_t addr, int64_t& rateDist, int64_t* lambda, int64_t &bestCost) { + Slice* slice = m_frame->m_encData->m_slice; + const CUData* cu = m_frame->m_encData->getPicCTU(addr); int64_t bestDist = 0; int bestTypeIdx = -1; - SaoCtuParam* lclCtuParam = &saoParam->ctuParam[0][addr]; int32_t distClasses[MAX_NUM_SAO_CLASS]; @@ -1467,19 +1491,27 @@ m_entropyCoder.load(m_rdContexts.temp); m_entropyCoder.resetBits(); m_entropyCoder.codeSaoType(0); - int64_t costPartBest = calcSaoRdoCost(0, m_entropyCoder.getNumberOfWrittenBits(), lambda[0]); + int maxSaoType; + if (m_param->bLimitSAO && ((slice->m_sliceType == P_SLICE && cu->isSkipped(0)) || + (slice->m_sliceType == B_SLICE))) + { + maxSaoType = MAX_NUM_SAO_TYPE - 3; + } + else + { + maxSaoType = MAX_NUM_SAO_TYPE - 1; + } //EO distortion calculation - for (int typeIdx = 0; typeIdx < MAX_NUM_SAO_TYPE - 1; typeIdx++) + for (int typeIdx = 0; typeIdx < maxSaoType; typeIdx++) { int64_t estDist = 0; for (int classIdx = 1; classIdx < SAO_NUM_OFFSET + 1; classIdx++) { - int32_t& count = m_count[0][typeIdx][classIdx]; + int32_t& count = m_count[0][typeIdx][classIdx]; int32_t& offsetOrg = m_offsetOrg[0][typeIdx][classIdx]; int32_t& offsetOut = m_offset[0][typeIdx][classIdx]; - estIterOffset(typeIdx, lambda[0], count, offsetOrg, offsetOut, distClasses[classIdx], costClasses[classIdx]); //Calculate distortion @@ -1569,12 +1601,12 @@ bestCost = rateDist + m_entropyCoder.getNumberOfWrittenBits(); } } - void SAO::saoChromaComponentParamDist(SAOParam* saoParam, int32_t addr, int64_t& rateDist, int64_t* lambda, int64_t &bestCost) { + Slice* slice = m_frame->m_encData->m_slice; + const CUData* cu = m_frame->m_encData->getPicCTU(addr); int64_t bestDist = 0; int bestTypeIdx = -1; - SaoCtuParam* lclCtuParam[2] = { &saoParam->ctuParam[1][addr], &saoParam->ctuParam[2][addr] }; int64_t costClasses[MAX_NUM_SAO_CLASS]; @@ -1587,9 +1619,19 @@ uint32_t bits = m_entropyCoder.getNumberOfWrittenBits(); int64_t costPartBest = calcSaoRdoCost(0, bits, lambda[1]); + int maxSaoType; + if (m_param->bLimitSAO && ((slice->m_sliceType == P_SLICE && cu->isSkipped(0)) || + (slice->m_sliceType == B_SLICE))) + { + maxSaoType = MAX_NUM_SAO_TYPE - 3; + } + else + { + maxSaoType = MAX_NUM_SAO_TYPE - 1; + } //EO RDO - for (int typeIdx = 0; typeIdx < MAX_NUM_SAO_TYPE - 1; typeIdx++) + for (int typeIdx = 0; typeIdx < maxSaoType; typeIdx++) { int64_t estDist[2] = {0, 0}; for (int compIdx = 1; compIdx < 3; compIdx++)
View file
x265_2.3.tar.gz/source/encoder/sao.h -> x265_2.4.tar.gz/source/encoder/sao.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -133,9 +133,7 @@ void rdoSaoUnitRowEnd(const SAOParam* saoParam, int numctus); void rdoSaoUnitCu(SAOParam* saoParam, int rowBaseAddr, int idxX, int addr); int64_t calcSaoRdoCost(int64_t distortion, uint32_t bits, int64_t lambda); - - void saoStatsInitialOffset(int planes); - + void saoStatsInitialOffset(int addr, int planes); friend class FrameFilter; };
View file
x265_2.3.tar.gz/source/encoder/search.cpp -> x265_2.4.tar.gz/source/encoder/search.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -2150,7 +2150,8 @@ cu.getNeighbourMV(puIdx, pu.puAbsPartIdx, interMode.interNeighbours); /* Uni-directional prediction */ - if (m_param->analysisMode == X265_ANALYSIS_LOAD || (m_param->analysisMultiPassRefine && m_param->rc.bStatRead)) + if ((m_param->analysisMode == X265_ANALYSIS_LOAD && m_param->analysisRefineLevel > 1) + || (m_param->analysisMultiPassRefine && m_param->rc.bStatRead)) { for (int list = 0; list < numPredDir; list++) {
View file
x265_2.3.tar.gz/source/encoder/search.h -> x265_2.4.tar.gz/source/encoder/search.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/encoder/sei.cpp -> x265_2.4.tar.gz/source/encoder/sei.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * @@ -38,24 +38,38 @@ * in bitstream bs */ void SEI::write(Bitstream& bs, const SPS& sps) { - BitCounter count; - m_bitIf = &count; - - /* virtual writeSEI method, write to bit counter */ - writeSEI(sps); - + uint32_t type = m_payloadType; m_bitIf = &bs; - uint32_t type = payloadType(); - for (; type >= 0xff; type -= 0xff) - WRITE_CODE(0xff, 8, "payload_type"); + BitCounter count; + bool hrdTypes = (m_payloadType == ACTIVE_PARAMETER_SETS || m_payloadType == PICTURE_TIMING || m_payloadType == BUFFERING_PERIOD); + if (hrdTypes) + { + m_bitIf = &count; + /* virtual writeSEI method, write to bit counter to determine size */ + writeSEI(sps); + m_bitIf = &bs; + uint32_t payloadType = m_payloadType; + for (; payloadType >= 0xff; payloadType -= 0xff) + WRITE_CODE(0xff, 8, "payload_type"); + } WRITE_CODE(type, 8, "payload_type"); + uint32_t payloadSize; + if (hrdTypes || m_payloadType == USER_DATA_UNREGISTERED) + { + if (hrdTypes) + { + X265_CHECK(0 == (count.getNumberOfWrittenBits() & 7), "payload unaligned\n"); + payloadSize = count.getNumberOfWrittenBits() >> 3; + } + else + payloadSize = m_payloadSize + 16; - X265_CHECK(0 == (count.getNumberOfWrittenBits() & 7), "payload unaligned\n"); - uint32_t payloadSize = count.getNumberOfWrittenBits() >> 3; - for (; payloadSize >= 0xff; payloadSize -= 0xff) - WRITE_CODE(0xff, 8, "payload_size"); - WRITE_CODE(payloadSize, 8, "payload_size"); - + for (; payloadSize >= 0xff; payloadSize -= 0xff) + WRITE_CODE(0xff, 8, "payload_size"); + WRITE_CODE(payloadSize, 8, "payload_size"); + } + else if(m_payloadType != USER_DATA_REGISTERED_ITU_T_T35) + WRITE_CODE(m_payloadSize, 8, "payload_size"); /* virtual writeSEI method, write to bs */ writeSEI(sps); } @@ -72,3 +86,8 @@ } } } + +void SEI::setSize(uint32_t size) +{ + m_payloadSize = size; +}
View file
x265_2.3.tar.gz/source/encoder/sei.h -> x265_2.4.tar.gz/source/encoder/sei.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (C) 2013 x265 project +* Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * @@ -34,53 +34,34 @@ class SEI : public SyntaxElementWriter { public: + /* SEI users call write() to marshal an SEI to a bitstream. + * The write() method calls writeSEI() which encodes the header */ + void write(Bitstream& bs, const SPS& sps); - /* SEI users call write() to marshal an SEI to a bitstream. SEI - * subclasses may implement write() or accept the default write() - * method which calls writeSEI() with a bitcounter to determine - * the size, then it encodes the header and calls writeSEI a - * second time for the real encode. */ - virtual void write(Bitstream& bs, const SPS& sps); - + void setSize(uint32_t size); virtual ~SEI() {} - protected: - - virtual SEIPayloadType payloadType() const = 0; - - virtual void writeSEI(const SPS&) { X265_CHECK(0, "empty writeSEI method called\n"); } - + SEIPayloadType m_payloadType; + uint32_t m_payloadSize; + virtual void writeSEI(const SPS&) = 0; void writeByteAlign(); }; class SEIuserDataUnregistered : public SEI { public: - - SEIPayloadType payloadType() const { return m_payloadType; } - - SEIuserDataUnregistered() : m_userData(NULL) {} - + SEIuserDataUnregistered() : m_userData(NULL) + { + m_payloadType = USER_DATA_UNREGISTERED; + m_payloadSize = 0; + } static const uint8_t m_uuid_iso_iec_11578[16]; - SEIPayloadType m_payloadType; - uint32_t m_userDataLength; uint8_t *m_userData; - - void write(Bitstream& bs, const SPS&) + void writeSEI(const SPS&) { - m_bitIf = &bs; - - WRITE_CODE(m_payloadType, 8, "payload_type"); - - uint32_t payloadSize = 16 + m_userDataLength; - for (; payloadSize >= 0xff; payloadSize -= 0xff) - WRITE_CODE(0xff, 8, "payload_size"); - WRITE_CODE(payloadSize, 8, "payload_size"); - for (uint32_t i = 0; i < 16; i++) WRITE_CODE(m_uuid_iso_iec_11578[i], 8, "sei.uuid_iso_iec_11578[i]"); - - for (uint32_t i = 0; i < m_userDataLength; i++) + for (uint32_t i = 0; i < m_payloadSize; i++) WRITE_CODE(m_userData[i], 8, "user_data"); } }; @@ -88,15 +69,16 @@ class SEIMasteringDisplayColorVolume : public SEI { public: - + SEIMasteringDisplayColorVolume() + { + m_payloadType = MASTERING_DISPLAY_INFO; + m_payloadSize = (8 * 2 + 2 * 4); + } uint16_t displayPrimaryX[3]; uint16_t displayPrimaryY[3]; uint16_t whitePointX, whitePointY; uint32_t maxDisplayMasteringLuminance; uint32_t minDisplayMasteringLuminance; - - SEIPayloadType payloadType() const { return MASTERING_DISPLAY_INFO; } - bool parse(const char* value) { return sscanf(value, "G(%hu,%hu)B(%hu,%hu)R(%hu,%hu)WP(%hu,%hu)L(%u,%u)", @@ -106,14 +88,8 @@ &whitePointX, &whitePointY, &maxDisplayMasteringLuminance, &minDisplayMasteringLuminance) == 10; } - - void write(Bitstream& bs, const SPS&) + void writeSEI(const SPS&) { - m_bitIf = &bs; - - WRITE_CODE(MASTERING_DISPLAY_INFO, 8, "payload_type"); - WRITE_CODE(8 * 2 + 2 * 4, 8, "payload_size"); - for (uint32_t i = 0; i < 3; i++) { WRITE_CODE(displayPrimaryX[i], 16, "display_primaries_x[ c ]"); @@ -129,18 +105,15 @@ class SEIContentLightLevel : public SEI { public: - + SEIContentLightLevel() + { + m_payloadType = CONTENT_LIGHT_LEVEL_INFO; + m_payloadSize = 4; + } uint16_t max_content_light_level; uint16_t max_pic_average_light_level; - - SEIPayloadType payloadType() const { return CONTENT_LIGHT_LEVEL_INFO; } - - void write(Bitstream& bs, const SPS&) + void writeSEI(const SPS&) { - m_bitIf = &bs; - - WRITE_CODE(CONTENT_LIGHT_LEVEL_INFO, 8, "payload_type"); - WRITE_CODE(4, 8, "payload_size"); WRITE_CODE(max_content_light_level, 16, "max_content_light_level"); WRITE_CODE(max_pic_average_light_level, 16, "max_pic_average_light_level"); } @@ -149,42 +122,22 @@ class SEIDecodedPictureHash : public SEI { public: - - SEIPayloadType payloadType() const { return DECODED_PICTURE_HASH; } - + SEIDecodedPictureHash() + { + m_payloadType = DECODED_PICTURE_HASH; + m_payloadSize = 0; + } enum Method { MD5, CRC, CHECKSUM, } m_method; - uint8_t m_digest[3][16]; - - void write(Bitstream& bs, const SPS& sps) + void writeSEI(const SPS& sps) { - m_bitIf = &bs; - int planes = (sps.chromaFormatIdc != X265_CSP_I400) ? 3 : 1; - - WRITE_CODE(DECODED_PICTURE_HASH, 8, "payload_type"); - - switch (m_method) - { - case MD5: - WRITE_CODE(1 + 16 * planes, 8, "payload_size"); - WRITE_CODE(MD5, 8, "hash_type"); - break; - case CRC: - WRITE_CODE(1 + 2 * planes, 8, "payload_size"); - WRITE_CODE(CRC, 8, "hash_type"); - break; - case CHECKSUM: - WRITE_CODE(1 + 4 * planes, 8, "payload_size"); - WRITE_CODE(CHECKSUM, 8, "hash_type"); - break; - } - + WRITE_CODE(m_method, 8, "hash_type"); for (int yuvIdx = 0; yuvIdx < planes; yuvIdx++) { if (m_method == MD5) @@ -209,9 +162,11 @@ class SEIActiveParameterSets : public SEI { public: - - SEIPayloadType payloadType() const { return ACTIVE_PARAMETER_SETS; } - + SEIActiveParameterSets() + { + m_payloadType = ACTIVE_PARAMETER_SETS; + m_payloadSize = 0; + } bool m_selfContainedCvsFlag; bool m_noParamSetUpdateFlag; @@ -229,16 +184,14 @@ class SEIBufferingPeriod : public SEI { public: - - SEIPayloadType payloadType() const { return BUFFERING_PERIOD; } - SEIBufferingPeriod() : m_cpbDelayOffset(0) , m_dpbDelayOffset(0) , m_auCpbRemovalDelayDelta(1) { + m_payloadType = BUFFERING_PERIOD; + m_payloadSize = 0; } - bool m_cpbDelayOffset; bool m_dpbDelayOffset; uint32_t m_initialCpbRemovalDelay; @@ -263,9 +216,11 @@ class SEIPictureTiming : public SEI { public: - - SEIPayloadType payloadType() const { return PICTURE_TIMING; } - + SEIPictureTiming() + { + m_payloadType = PICTURE_TIMING; + m_payloadSize = 0; + } uint32_t m_picStruct; uint32_t m_sourceScanType; bool m_duplicateFlag; @@ -298,9 +253,6 @@ class SEIRecoveryPoint : public SEI { public: - - SEIPayloadType payloadType() const { return RECOVERY_POINT; } - int m_recoveryPocCnt; bool m_exactMatchingFlag; bool m_brokenLinkFlag; @@ -313,6 +265,39 @@ writeByteAlign(); } }; -} +//seongnam.oh@samsung.com :: for the Creative Intent Meta Data Encoding +class SEICreativeIntentMeta : public SEI +{ +public: + SEICreativeIntentMeta() + { + m_payloadType = USER_DATA_REGISTERED_ITU_T_T35; + m_payloadSize = 0; + } + + uint8_t *cim; + + // daniel.vt@samsung.com :: for the Creative Intent Meta Data Encoding ( seongnam.oh@samsung.com ) + void writeSEI(const SPS&) + { + if (!cim) + return; + + int i = 0; + int payloadSize = m_payloadSize; + while (cim[i] == 0xFF) + { + i++; + payloadSize += cim[i]; + WRITE_CODE(0xFF, 8, "payload_size"); + } + WRITE_CODE(payloadSize, 8, "payload_size"); + i++; + payloadSize += i; + for (; i < payloadSize; ++i) + WRITE_CODE(cim[i], 8, "creative_intent_metadata"); + } +}; +} #endif // ifndef X265_SEI_H
View file
x265_2.3.tar.gz/source/encoder/slicetype.cpp -> x265_2.4.tar.gz/source/encoder/slicetype.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com> * Steve Borho <steve@borho.org> @@ -105,6 +105,21 @@ x265_emms(); return var; } +/* Find the sum of pixels of each block for luma plane */ +uint32_t LookaheadTLD::lumaSumCu(Frame* curFrame, uint32_t blockX, uint32_t blockY, uint32_t qgSize) +{ + intptr_t stride = curFrame->m_fencPic->m_stride; + intptr_t blockOffsetLuma = blockX + (blockY * stride); + uint64_t sum_ssd; + + if (qgSize == 8) + sum_ssd = primitives.cu[BLOCK_8x8].var(curFrame->m_fencPic->m_picOrg[0] + blockOffsetLuma, stride); + else + sum_ssd = primitives.cu[BLOCK_16x16].var(curFrame->m_fencPic->m_picOrg[0] + blockOffsetLuma, stride); + + x265_emms(); + return (uint32_t)sum_ssd; +} void LookaheadTLD::calcAdaptiveQuantFrame(Frame *curFrame, x265_param* param) { @@ -227,6 +242,30 @@ uint32_t energy = acEnergyCu(curFrame, blockX, blockY, param->internalCsp,param->rc.qgSize); qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) - (modeOneConst + 2 * (X265_DEPTH - 8))); } + + if (param->bHDROpt) + { + uint32_t sum = lumaSumCu(curFrame, blockX, blockY, param->rc.qgSize); + uint32_t lumaAvg = sum / (loopIncr * loopIncr); + if (lumaAvg < 301) + qp_adj += 3; + else if (lumaAvg >= 301 && lumaAvg < 367) + qp_adj += 2; + else if (lumaAvg >= 367 && lumaAvg < 434) + qp_adj += 1; + else if (lumaAvg >= 501 && lumaAvg < 567) + qp_adj -= 1; + else if (lumaAvg >= 567 && lumaAvg < 634) + qp_adj -= 2; + else if (lumaAvg >= 634 && lumaAvg < 701) + qp_adj -= 3; + else if (lumaAvg >= 701 && lumaAvg < 767) + qp_adj -= 4; + else if (lumaAvg >= 767 && lumaAvg < 834) + qp_adj -= 5; + else if (lumaAvg >= 834) + qp_adj -= 6; + } if (quantOffsets != NULL) qp_adj += quantOffsets[blockXY]; curFrame->m_lowres.qpAqOffset[blockXY] = qp_adj;
View file
x265_2.3.tar.gz/source/encoder/slicetype.h -> x265_2.4.tar.gz/source/encoder/slicetype.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -91,6 +91,7 @@ protected: uint32_t acEnergyCu(Frame* curFrame, uint32_t blockX, uint32_t blockY, int csp, uint32_t qgSize); + uint32_t lumaSumCu(Frame* curFrame, uint32_t blockX, uint32_t blockY, uint32_t qgSize); uint32_t weightCostLuma(Lowres& fenc, Lowres& ref, WeightParam& wp); bool allocWeightedRef(Lowres& fenc); };
View file
x265_2.3.tar.gz/source/encoder/weightPrediction.cpp -> x265_2.4.tar.gz/source/encoder/weightPrediction.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Author: Shazeb Nawaz Khan <shazeb@multicorewareinc.com> * Steve Borho <steve@borho.org>
View file
x265_2.3.tar.gz/source/input/input.cpp -> x265_2.4.tar.gz/source/input/input.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/input/input.h -> x265_2.4.tar.gz/source/input/input.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/input/y4m.cpp -> x265_2.4.tar.gz/source/input/y4m.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * @@ -141,7 +141,14 @@ if (info.skipFrames) { #if X86_64 - ifs->seekg((uint64_t)estFrameSize * info.skipFrames, ios::cur); + if (ifs != &cin) + ifs->seekg((uint64_t)estFrameSize * info.skipFrames, ios::cur); + else + for (int i = 0; i < info.skipFrames; i++) + { + ifs->read(buf[0], estFrameSize - framesize); + ifs->read(buf[0], framesize); + } #else for (int i = 0; i < info.skipFrames; i++) ifs->ignore(estFrameSize);
View file
x265_2.3.tar.gz/source/input/y4m.h -> x265_2.4.tar.gz/source/input/y4m.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/input/yuv.cpp -> x265_2.4.tar.gz/source/input/yuv.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * @@ -131,7 +131,11 @@ if (info.skipFrames) { #if X86_64 - ifs->seekg((uint64_t)framesize * info.skipFrames, ios::cur); + if (ifs != &cin) + ifs->seekg((uint64_t)framesize * info.skipFrames, ios::cur); + else + for (int i = 0; i < info.skipFrames; i++) + ifs->read(buf[0], framesize); #else for (int i = 0; i < info.skipFrames; i++) ifs->ignore(framesize);
View file
x265_2.3.tar.gz/source/input/yuv.h -> x265_2.4.tar.gz/source/input/yuv.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/output/output.cpp -> x265_2.4.tar.gz/source/output/output.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013-2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Xinyue Lu <i@7086.in>
View file
x265_2.3.tar.gz/source/output/output.h -> x265_2.4.tar.gz/source/output/output.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013-2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Xinyue Lu <i@7086.in>
View file
x265_2.3.tar.gz/source/output/raw.cpp -> x265_2.4.tar.gz/source/output/raw.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013-2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Xinyue Lu <i@7086.in>
View file
x265_2.3.tar.gz/source/output/raw.h -> x265_2.4.tar.gz/source/output/raw.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013-2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Xinyue Lu <i@7086.in>
View file
x265_2.3.tar.gz/source/output/reconplay.cpp -> x265_2.4.tar.gz/source/output/reconplay.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Peixuan Zhang <zhangpeixuancn@gmail.com> * Chunli Zhang <chunli@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/output/reconplay.h -> x265_2.4.tar.gz/source/output/reconplay.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Peixuan Zhang <zhangpeixuancn@gmail.com> * Chunli Zhang <chunli@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/output/y4m.cpp -> x265_2.4.tar.gz/source/output/y4m.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/output/y4m.h -> x265_2.4.tar.gz/source/output/y4m.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/output/yuv.cpp -> x265_2.4.tar.gz/source/output/yuv.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/output/yuv.h -> x265_2.4.tar.gz/source/output/yuv.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/profile/PPA/ppa.cpp -> x265_2.4.tar.gz/source/profile/PPA/ppa.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/profile/PPA/ppa.h -> x265_2.4.tar.gz/source/profile/PPA/ppa.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/profile/PPA/ppaApi.h -> x265_2.4.tar.gz/source/profile/PPA/ppaApi.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/profile/vtune/vtune.cpp -> x265_2.4.tar.gz/source/profile/vtune/vtune.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/profile/vtune/vtune.h -> x265_2.4.tar.gz/source/profile/vtune/vtune.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/test/checkasm-a.asm -> x265_2.4.tar.gz/source/test/checkasm-a.asm
Changed
@@ -1,8 +1,8 @@ ;***************************************************************************** ;* checkasm-a.asm: assembly check tool ;***************************************************************************** -;* Copyright (C) 2008-2014 x264 project -;* Copyright (C) 2013-2015 x265 project +;* Copyright (C) 2003-2013 x264 project +;* Copyright (C) 2013-2017 MulticoreWare, Inc ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Henrik Gramner <henrik@gramner.com>
View file
x265_2.3.tar.gz/source/test/checkasm-arm.S -> x265_2.4.tar.gz/source/test/checkasm-arm.S
Changed
@@ -1,7 +1,7 @@ /**************************************************************************** * checkasm-arm.S: assembly check tool ***************************************************************************** - * Copyright (C) 2016 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Martin Storsjo <martin@martin.st> * Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/test/intrapredharness.cpp -> x265_2.4.tar.gz/source/test/intrapredharness.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Min Chen <chenm003@163.com> *
View file
x265_2.3.tar.gz/source/test/intrapredharness.h -> x265_2.4.tar.gz/source/test/intrapredharness.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Min Chen <chenm003@163.com> *
View file
x265_2.3.tar.gz/source/test/ipfilterharness.cpp -> x265_2.4.tar.gz/source/test/ipfilterharness.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Devaki <deepthidevaki@multicorewareinc.com>, * Rajesh Paulraj <rajesh@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/test/ipfilterharness.h -> x265_2.4.tar.gz/source/test/ipfilterharness.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Deepthi Devaki <deepthidevaki@multicorewareinc.com>, * Rajesh Paulraj <rajesh@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/test/mbdstharness.cpp -> x265_2.4.tar.gz/source/test/mbdstharness.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <min.chen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/test/mbdstharness.h -> x265_2.4.tar.gz/source/test/mbdstharness.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <min.chen@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/test/pixelharness.cpp -> x265_2.4.tar.gz/source/test/pixelharness.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/test/pixelharness.h -> x265_2.4.tar.gz/source/test/pixelharness.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/test/regression-tests.txt -> x265_2.4.tar.gz/source/test/regression-tests.txt
Changed
@@ -17,17 +17,17 @@ BasketballDrive_1920x1080_50.y4m,--preset faster --aq-strength 2 --merange 190 --slices 3 BasketballDrive_1920x1080_50.y4m,--preset medium --ctu 16 --max-tu-size 8 --subme 7 --qg-size 16 --cu-lossless --tu-inter-depth 3 --limit-tu 1 BasketballDrive_1920x1080_50.y4m,--preset medium --keyint -1 --nr-inter 100 -F4 --no-sao -BasketballDrive_1920x1080_50.y4m,--preset medium --no-cutree --analysis-mode=save --bitrate 7000 --limit-modes,--preset medium --no-cutree --analysis-mode=load --bitrate 7000 --limit-modes +BasketballDrive_1920x1080_50.y4m,--preset medium --no-cutree --analysis-mode=save --refine-level 2 --bitrate 7000 --limit-modes,--preset medium --no-cutree --analysis-mode=load --refine-level 2 --bitrate 7000 --limit-modes BasketballDrive_1920x1080_50.y4m,--preset slow --nr-intra 100 -F4 --aq-strength 3 --qg-size 16 --limit-refs 1 BasketballDrive_1920x1080_50.y4m,--preset slower --lossless --chromaloc 3 --subme 0 --limit-tu 4 -BasketballDrive_1920x1080_50.y4m,--preset slower --no-cutree --analysis-mode=save --bitrate 7000,--preset slower --no-cutree --analysis-mode=load --bitrate 7000 +BasketballDrive_1920x1080_50.y4m,--preset slower --no-cutree --analysis-mode=save --refine-level 10 --bitrate 7000 --limit-tu 0,--preset slower --no-cutree --analysis-mode=load --refine-level 10 --bitrate 7000 --limit-tu 0 BasketballDrive_1920x1080_50.y4m,--preset veryslow --crf 4 --cu-lossless --pmode --limit-refs 1 --aq-mode 3 --limit-tu 3 BasketballDrive_1920x1080_50.y4m,--preset veryslow --no-cutree --analysis-mode=save --bitrate 7000 --tskip-fast --limit-tu 4,--preset veryslow --no-cutree --analysis-mode=load --bitrate 7000 --tskip-fast --limit-tu 4 BasketballDrive_1920x1080_50.y4m,--preset veryslow --recon-y4m-exec "ffplay -i pipe:0 -autoexit" Coastguard-4k.y4m,--preset ultrafast --recon-y4m-exec "ffplay -i pipe:0 -autoexit" Coastguard-4k.y4m,--preset superfast --tune grain --overscan=crop Coastguard-4k.y4m,--preset superfast --tune grain --pme --aq-strength 2 --merange 190 -Coastguard-4k.y4m,--preset veryfast --no-cutree --analysis-mode=save --bitrate 15000,--preset veryfast --no-cutree --analysis-mode=load --bitrate 15000 +Coastguard-4k.y4m,--preset veryfast --no-cutree --analysis-mode=save --refine-level 1 --bitrate 15000,--preset veryfast --no-cutree --analysis-mode=load --refine-level 1 --bitrate 15000 Coastguard-4k.y4m,--preset medium --rdoq-level 1 --tune ssim --no-signhide --me umh --slices 2 Coastguard-4k.y4m,--preset slow --tune psnr --cbqpoffs -1 --crqpoffs 1 --limit-refs 1 CrowdRun_1920x1080_50_10bit_422.yuv,--preset ultrafast --weightp --tune zerolatency --qg-size 16 @@ -68,8 +68,8 @@ KristenAndSara_1280x720_60.y4m,--preset slower --pmode --max-tu-size 8 --limit-refs 0 --limit-modes --limit-tu 1 NebutaFestival_2560x1600_60_10bit_crop.yuv,--preset superfast --tune psnr NebutaFestival_2560x1600_60_10bit_crop.yuv,--preset medium --tune grain --limit-refs 2 -NebutaFestival_2560x1600_60_10bit_crop.yuv,--preset slow --no-cutree --analysis-mode=save --bitrate 9000,--preset slow --no-cutree --analysis-mode=load --bitrate 9000 -News-4k.y4m,--preset ultrafast --no-cutree --analysis-mode=save --bitrate 15000,--preset ultrafast --no-cutree --analysis-mode=load --bitrate 15000 +NebutaFestival_2560x1600_60_10bit_crop.yuv,--preset slow --no-cutree --analysis-mode=save --rd 5 --refine-level 10 --bitrate 9000,--preset slow --no-cutree --analysis-mode=load --rd 5 --refine-level 10 --bitrate 9000 +News-4k.y4m,--preset ultrafast --no-cutree --analysis-mode=save --refine-level 2 --bitrate 15000,--preset ultrafast --no-cutree --analysis-mode=load --refine-level 2 --bitrate 15000 News-4k.y4m,--preset superfast --lookahead-slices 6 --aq-mode 0 News-4k.y4m,--preset superfast --slices 4 --aq-mode 0 News-4k.y4m,--preset medium --tune ssim --no-sao --qg-size 16 @@ -123,7 +123,7 @@ old_town_cross_444_720p50.y4m,--preset superfast --weightp --min-cu 16 --limit-modes old_town_cross_444_720p50.y4m,--preset veryfast --qp 1 --tune ssim old_town_cross_444_720p50.y4m,--preset faster --rd 1 --tune zero-latency -old_town_cross_444_720p50.y4m,--preset fast --no-cutree --analysis-mode=save --bitrate 3000 --early-skip,--preset fast --no-cutree --analysis-mode=load --bitrate 3000 --early-skip +old_town_cross_444_720p50.y4m,--preset fast --no-cutree --analysis-mode=save --refine-level 1 --bitrate 3000 --early-skip,--preset fast --no-cutree --analysis-mode=load --refine-level 1 --bitrate 3000 --early-skip old_town_cross_444_720p50.y4m,--preset medium --keyint -1 --no-weightp --ref 6 old_town_cross_444_720p50.y4m,--preset slow --rdoq-level 1 --early-skip --ref 7 --no-b-pyramid old_town_cross_444_720p50.y4m,--preset slower --crf 4 --cu-lossless
View file
x265_2.3.tar.gz/source/test/smoke-tests.txt -> x265_2.4.tar.gz/source/test/smoke-tests.txt
Changed
@@ -19,6 +19,6 @@ DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset=veryfast --min-cu 16 DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset=fast --weightb --interlace bff DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset=veryslow --limit-ref 1 --limit-mode --tskip --limit-tu 1 - +CrowdRun_1920x1080_50_10bit_444.yuv,--preset=superfast --bitrate 7000 --sao --limit-sao # Main12 intraCost overflow bug test 720p50_parkrun_ter.y4m,--preset medium
View file
x265_2.3.tar.gz/source/test/testbench.cpp -> x265_2.4.tar.gz/source/test/testbench.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Gopu Govindaswamy <gopu@govindaswamy.org> * Mandar Gurav <mandar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/test/testharness.h -> x265_2.4.tar.gz/source/test/testharness.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com>
View file
x265_2.3.tar.gz/source/x265-extras.cpp -> x265_2.4.tar.gz/source/x265-extras.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Selvakumar Nithiyaruban <selvakumar@multicorewareinc.com>
View file
x265_2.3.tar.gz/source/x265-extras.h -> x265_2.4.tar.gz/source/x265-extras.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2015 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/x265.cpp -> x265_2.4.tar.gz/source/x265.cpp
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * @@ -50,6 +50,7 @@ #define CONSOLE_TITLE_SIZE 200 #ifdef _WIN32 #include <windows.h> +#define SetThreadExecutionState(es) static char orgConsoleTitle[CONSOLE_TITLE_SIZE] = ""; #else #define GetConsoleTitle(t, n)
View file
x265_2.3.tar.gz/source/x265.h -> x265_2.4.tar.gz/source/x265.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -99,6 +99,7 @@ uint32_t numCUsInFrame; uint32_t numPartitions; int bScenecut; + void* wt; void* interData; void* intraData; } x265_analysis_data; @@ -960,12 +961,9 @@ /* Enable weighted prediction in B slices. Default is disabled */ int bEnableWeightedBiPred; - /* Enable source pixels in motion estimation. Default is disabled */ - int bSourceReferenceEstimation; - + int bSourceReferenceEstimation; /*== Loop Filters ==*/ - /* Enable the deblocking loop filter, which improves visual quality by * reducing blocking effects at block edges, particularly at lower bitrates * or higher QP. When enabled it adds another CU row of reference lag, @@ -1343,30 +1341,23 @@ /* Enable storing commonly RPS in SPS in multi pass mode */ int bMultiPassOptRPS; - /* This value represents the percentage difference between the inter cost and * intra cost of a frame used in scenecut detection. Default 5. */ - double scenecutBias; - + double scenecutBias; /* Use multiple worker threads dedicated to doing only lookahead instead of sharing * the worker threads with Frame Encoders. A dedicated lookahead threadpool is created with the * specified number of worker threads. This can range from 0 upto half the * hardware threads available for encoding. Using too many threads for lookahead can starve * resources for frame Encoder and can harm performance. Default is 0 - disabled. */ int lookaheadThreads; - /* Optimize CU level QPs to signal consistent deltaQPs in frame for rd level > 4 */ - int bOptCUDeltaQP; - + int bOptCUDeltaQP; /* Refine analysis in multipass ratecontrol based on analysis information stored */ - int analysisMultiPassRefine; - + int analysisMultiPassRefine; /* Refine analysis in multipass ratecontrol based on distortion data stored */ - int analysisMultiPassDistortion; - + int analysisMultiPassDistortion; /* Adaptive Quantization based on relative motion */ - int bAQMotion; - + int bAQMotion; /* SSIM based RDO, based on residual divisive normalization scheme. Used for mode * selection during analysis of CTUs, can achieve significant gain in terms of * objective quality metrics SSIM and PSNR */ @@ -1379,8 +1370,28 @@ * Auto-enabled when max-cll, max-fall, or mastering display info is specified. * Default is disabled */ int bEmitHDRSEI; -} x265_param; + /* Enable luma and chroma offsets for HDR/WCG content. + * Default is disabled */ + int bHDROpt; + + /* A value between 1 and 10 (both inclusive) determines the level of + * information stored/reused in save/load analysis-mode. Higher the refine + * level higher the informtion stored/reused. Default is 5 */ + int analysisRefineLevel; + + /* Limit Sample Adaptive Offset filter computation by early terminating SAO + * process based on inter prediction mode, CTU spatial-domain correlations, + * and relations between luma and chroma */ + int bLimitSAO; + + /* File containing the tone mapping information */ + const char* toneMapFile; + + /* Insert tone mapping information only for IDR frames and when the + * tone mapping information changes. */ + int bDhdr10opt; +} x265_param; /* x265_param_alloc: * Allocates an x265_param instance. The returned param structure is not * special in any way, but using this method together with x265_param_free()
View file
x265_2.3.tar.gz/source/x265_config.h.in -> x265_2.4.tar.gz/source/x265_config.h.in
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> *
View file
x265_2.3.tar.gz/source/x265cli.h -> x265_2.4.tar.gz/source/x265cli.h
Changed
@@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2013 x265 project + * Copyright (C) 2013-2017 MulticoreWare, Inc * * Authors: Steve Borho <steve@borho.org> * Min Chen <chenm003@163.com> @@ -249,6 +249,7 @@ { "no-multi-pass-opt-rps", no_argument, NULL, 0 }, { "analysis-mode", required_argument, NULL, 0 }, { "analysis-file", required_argument, NULL, 0 }, + { "refine-level", required_argument, NULL, 0 }, { "strict-cbr", no_argument, NULL, 0 }, { "temporal-layers", no_argument, NULL, 0 }, { "no-temporal-layers", no_argument, NULL, 0 }, @@ -263,6 +264,13 @@ { "no-ssim-rd", no_argument, NULL, 0 }, { "hdr", no_argument, NULL, 0 }, { "no-hdr", no_argument, NULL, 0 }, + { "hdr-opt", no_argument, NULL, 0 }, + { "no-hdr-opt", no_argument, NULL, 0 }, + { "limit-sao", no_argument, NULL, 0 }, + { "no-limit-sao", no_argument, NULL, 0 }, + { "dhdr10-info", required_argument, NULL, 0 }, + { "dhdr10-opt", no_argument, NULL, 0}, + { "no-dhdr10-opt", no_argument, NULL, 0}, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, @@ -308,6 +316,10 @@ H1(" 1 - i420 (4:2:0 default)\n"); H1(" 2 - i422 (4:2:2)\n"); H1(" 3 - i444 (4:4:4)\n"); +#if ENABLE_DYNAMIC_HDR10 + H0(" --dhdr10-info <filename> JSON file containing the Creative Intent Metadata to be encoded as Dynamic Tone Mapping \n"); + H0(" --[no-]dhdr10-opt Insert tone mapping SEI only for IDR frames and when the tone mapping information changes. Default disabled"); +#endif H0("-f/--frames <integer> Maximum number of frames to encode. Default all\n"); H0(" --seek <integer> First frame to encode\n"); H1(" --[no-]interlace <bff|tff> Indicate input pictures are interlace fields in temporal order. Default progressive\n"); @@ -421,6 +433,7 @@ H0(" --[no-]strict-cbr Enable stricter conditions and tolerance for bitrate deviations in CBR mode. Default %s\n", OPT(param->rc.bStrictCbr)); H0(" --analysis-mode <string|int> save - Dump analysis info into file, load - Load analysis buffers from the file. Default %d\n", param->analysisMode); H0(" --analysis-file <filename> Specify file name used for either dumping or reading analysis data.\n"); + H0(" --refine-level <1..10> Level of analysis refinement indicates amount of info stored/reused in save/load mode, 1:least....10:most. Default %d\n", param->analysisRefineLevel); H0(" --aq-mode <integer> Mode for Adaptive Quantization - 0:none 1:uniform AQ 2:auto variance 3:auto variance with bias to dark scenes. Default %d\n", param->rc.aqMode); H0(" --aq-strength <float> Reduces blocking and blurring in flat and textured areas (0 to 3.0). Default %.2f\n", param->rc.aqStrength); H0(" --[no-]aq-motion Adaptive Quantization based on the relative motion of each CU w.r.t., frame. Default %s\n", OPT(param->bOptCUDeltaQP)); @@ -450,6 +463,7 @@ H0(" --[no-]deblock Enable Deblocking Loop Filter, optionally specify tC:Beta offsets Default %s\n", OPT(param->bEnableLoopFilter)); H0(" --[no-]sao Enable Sample Adaptive Offset. Default %s\n", OPT(param->bEnableSAO)); H1(" --[no-]sao-non-deblock Use non-deblocked pixels, else right/bottom boundary areas skipped. Default %s\n", OPT(param->bSaoNonDeblocked)); + H0(" --[no-]limit-sao Limit Sample Adaptive Offset types. Default %s\n", OPT(param->bLimitSAO)); H0("\nVUI options:\n"); H0(" --sar <width:height|int> Sample Aspect Ratio, the ratio of width to height of an individual pixel.\n"); H0(" Choose from 0=undef, 1=1:1(\"square\"), 2=12:11, 3=10:11, 4=16:11,\n"); @@ -471,6 +485,7 @@ H0(" format: G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min)\n"); H0(" --max-cll <string> Emit content light level info SEI as \"cll,fall\" (HDR)\n"); H0(" --[no-]hdr Control dumping of HDR SEI packet. If max-cll or master-display has non-zero values, this is enabled. Default %s\n", OPT(param->bEmitHDRSEI)); + H0(" --[no-]hdr-opt Add luma and chroma offsets for HDR/WCG content. Default %s\n", OPT(param->bHDROpt)); H0(" --min-luma <integer> Minimum luma plane value of input source picture\n"); H0(" --max-luma <integer> Maximum luma plane value of input source picture\n"); H0("\nBitstream options:\n");
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.