2026-04-11 23:17:09 +01:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "en-US" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=11" / >
2026-10-08 20:15:08 +01:00
< meta name = "generator" content = "Doxygen 1.18.0" / >
2026-04-11 23:17:09 +01:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > libaaruformat: src/compression/zstd.c File Reference< / title >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "dynsections.js" > < / script >
2026-10-08 20:15:08 +01:00
< script type = "text/javascript" src = "codefolding.js" > < / script >
2026-04-11 23:17:09 +01:00
< script type = "text/javascript" src = "clipboard.js" > < / script >
< link href = "navtree.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "navtreedata.js" > < / script >
< script type = "text/javascript" src = "navtree.js" > < / script >
< script type = "text/javascript" src = "cookie.js" > < / script >
< link href = "search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "search/searchdata.js" > < / script >
< script type = "text/javascript" src = "search/search.js" > < / script >
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr id = "projectrow" >
< td id = "projectalign" >
< div id = "projectname" > libaaruformat< span id = "projectnumber" >   1.0< / span >
< / div >
< div id = "projectbrief" > Aaru Data Preservation Suite - Format Library< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2026-10-08 20:15:08 +01:00
<!-- Generated by Doxygen 1.18.0 -->
2026-04-11 23:17:09 +01:00
< script type = "text/javascript" >
2026-10-08 20:15:08 +01:00
let searchBox = new SearchBox("searchBox", "search/",'.html');
2026-04-11 23:17:09 +01:00
< / script >
< script type = "text/javascript" >
2026-10-08 20:15:08 +01:00
document.addEventListener('DOMContentLoaded', codefold.init);
< / script >
< script type = "application/json" id = "doxygen-config" >
{
"relPath": "",
"generateTreeView": true,
"searchEngine": true,
"serverBasedSearch": false,
"disableIndex": false,
"dynamicMenus": true,
"fullSidebar": false
}
2026-04-11 23:17:09 +01:00
< / script >
< script type = "text/javascript" src = "menudata.js" > < / script >
< script type = "text/javascript" src = "menu.js" > < / script >
2026-10-08 20:15:08 +01:00
< div id = "main-nav-mobile" >
< div class = "sm sm-dox" > < input id = "main-menu-state" type = "checkbox" / >
< label class = "main-menu-btn" for = "main-menu-state" >
< span class = "main-menu-btn-icon" > < / span > Toggle main menu visibility< / label >
< span id = "searchBoxPos1" > < / span >
< / div >
< / div > <!-- main - nav - mobile -->
< div id = "main-nav" >
< ul class = "sm sm-dox" id = "main-menu" >
< li id = "searchBoxPos2" >
< div id = "MSearchBox" class = "MSearchBoxInactive" >
< span class = "left" >
< span id = "MSearchSelect" class = "search-icon" > < span class = "search-icon-dropdown" > < / span > < / span >
< input type = "text" id = "MSearchField" value = "" placeholder = "Search" accesskey = "S" / >
< / span > < span class = "right" >
< a id = "MSearchClose" href = "javascript:searchBox.CloseResultsWindow()" > < div id = "MSearchCloseImg" class = "close-icon" > < / div > < / a >
< / span >
< / div >
< / li >
< / ul >
< / div > <!-- main - nav -->
2026-04-11 23:17:09 +01:00
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
2026-10-08 20:15:08 +01:00
< div id = "splitbar" class = "ui-resizable-handle" >
2026-04-11 23:17:09 +01:00
< / div >
< / div >
< script type = "text/javascript" >
2026-10-08 20:15:08 +01:00
document.addEventListener('DOMContentLoaded',() => { initNavTree('zstd_8c.html','',''); });
2026-04-11 23:17:09 +01:00
< / script >
< div id = "container" >
< div id = "doc-content" >
<!-- window showing the filter options -->
2026-10-08 20:15:08 +01:00
< div id = "MSearchSelectWindow" >
2026-04-11 23:17:09 +01:00
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
< div id = "MSearchResults" >
< div class = "SRPage" >
< div id = "SRIndex" >
< div id = "SRResults" > < / div >
< div class = "SRStatus" id = "Loading" > Loading...< / div >
< div class = "SRStatus" id = "Searching" > Searching...< / div >
< div class = "SRStatus" id = "NoMatches" > No Matches< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "header" >
< div class = "headertitle" > < div class = "title" > zstd.c File Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< div class = "textblock" > < code > #include < stddef.h> < / code > < br / >
< code > #include < stdint.h> < / code > < br / >
< code > #include < < a class = "el" href = "aaruformat_8h_source.html" > aaruformat.h< / a > > < / code > < br / >
< code > #include < zstd.h> < / code > < br / >
< / div >
< p > < a href = "zstd_8c_source.html" > Go to the source code of this file.< / a > < / p >
< table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 id = "header-func-members" class = "groupheader" > < a id = "func-members" name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:ac0f8004dbea44979bf8b58c3e3a1a6ae" id = "r_ac0f8004dbea44979bf8b58c3e3a1a6ae" > < td class = "memItemLeft" > size_t  < / td > < td class = "memItemRight" > < a class = "el" href = "#ac0f8004dbea44979bf8b58c3e3a1a6ae" > aaruf_zstd_decode_buffer< / a > (uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size)< / td > < / tr >
< tr class = "memdesc:ac0f8004dbea44979bf8b58c3e3a1a6ae" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Decodes a Zstandard-compressed buffer. < br / > < / td > < / tr >
< tr class = "memitem:a3950b73c924a7096bb2313e0858a315a" id = "r_a3950b73c924a7096bb2313e0858a315a" > < td class = "memItemLeft" > size_t  < / td > < td class = "memItemRight" > < a class = "el" href = "#a3950b73c924a7096bb2313e0858a315a" > aaruf_zstd_encode_buffer< / a > (uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size, int level, int num_threads)< / td > < / tr >
< tr class = "memdesc:a3950b73c924a7096bb2313e0858a315a" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Encodes a buffer using Zstandard compression. < br / > < / td > < / tr >
< / table >
< a name = "doc-func-members" id = "doc-func-members" > < / a > < h2 id = "header-doc-func-members" class = "groupheader" > Function Documentation< / h2 >
< a id = "ac0f8004dbea44979bf8b58c3e3a1a6ae" name = "ac0f8004dbea44979bf8b58c3e3a1a6ae" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ac0f8004dbea44979bf8b58c3e3a1a6ae" > ◆   < / a > < / span > aaruf_zstd_decode_buffer()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > size_t aaruf_zstd_decode_buffer < / td >
< td > (< / td >
< td class = "paramtype" > uint8_t *< / td > < td class = "paramname" > < span class = "paramname" > < em > dst_buffer< / em > < / span > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > size_t< / td > < td class = "paramname" > < span class = "paramname" > < em > dst_size< / em > < / span > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const uint8_t *< / td > < td class = "paramname" > < span class = "paramname" > < em > src_buffer< / em > < / span > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > size_t< / td > < td class = "paramname" > < span class = "paramname" > < em > src_size< / em > < / span >   )< / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Decodes a Zstandard-compressed buffer. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > dst_buffer< / td > < td > Pointer to the destination buffer. < / td > < / tr >
< tr > < td class = "paramname" > dst_size< / td > < td > Size of the destination buffer. < / td > < / tr >
< tr > < td class = "paramname" > src_buffer< / td > < td > Pointer to the source (compressed) buffer. < / td > < / tr >
< tr > < td class = "paramname" > src_size< / td > < td > Size of the source buffer. < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > Number of decompressed bytes, or 0 on error. < / dd > < / dl >
< p class = "definition" > Definition at line < a class = "el" href = "zstd_8c_source.html#l00034" > 34< / a > of file < a class = "el" href = "zstd_8c_source.html" > zstd.c< / a > .< / p >
2026-10-08 20:15:08 +01:00
< p class = "reference" > References < a class = "el" href = "decls_8h_source.html#l00046" > AARU_CALL< / a > , < a class = "el" href = "decls_8h_source.html#l00055" > AARU_EXPORT< / a > , and < a class = "el" href = "zstd_8c_source.html#l00034" > aaruf_zstd_decode_buffer()< / a > .< / p >
2026-04-11 23:17:09 +01:00
2026-10-08 20:15:08 +01:00
< p class = "reference" > Referenced by < a class = "el" href = "read_8c_source.html#l00352" > aaruf_read_sector()< / a > , < a class = "el" href = "zstd_8c_source.html#l00034" > aaruf_zstd_decode_buffer()< / a > , < a class = "el" href = "ddt__v2_8c_source.html#l00663" > decode_ddt_entry_v2()< / a > , < a class = "el" href = "ddt__v2_8c_source.html#l00948" > decode_ddt_multi_level_v2()< / a > , < a class = "el" href = "erasure_8c_source.html#l01046" > ec_load_ecmb()< / a > , < a class = "el" href = "erasure_8c_source.html#l01303" > ec_recover_data_block()< / a > , < a class = "el" href = "data_8c_source.html#l00073" > process_data_block()< / a > , < a class = "el" href = "ddt__v1_8c_source.html#l00086" > process_ddt_v1()< / a > , < a class = "el" href = "ddt__v2_8c_source.html#l00097" > process_ddt_v2()< / a > , and < a class = "el" href = "flux_8c_source.html#l01034" > read_zstd_compressed_payload()< / a > .< / p >
2026-04-11 23:17:09 +01:00
< / div >
< / div >
< a id = "a3950b73c924a7096bb2313e0858a315a" name = "a3950b73c924a7096bb2313e0858a315a" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a3950b73c924a7096bb2313e0858a315a" > ◆   < / a > < / span > aaruf_zstd_encode_buffer()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > size_t aaruf_zstd_encode_buffer < / td >
< td > (< / td >
< td class = "paramtype" > uint8_t *< / td > < td class = "paramname" > < span class = "paramname" > < em > dst_buffer< / em > < / span > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > size_t< / td > < td class = "paramname" > < span class = "paramname" > < em > dst_size< / em > < / span > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const uint8_t *< / td > < td class = "paramname" > < span class = "paramname" > < em > src_buffer< / em > < / span > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > size_t< / td > < td class = "paramname" > < span class = "paramname" > < em > src_size< / em > < / span > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int< / td > < td class = "paramname" > < span class = "paramname" > < em > level< / em > < / span > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int< / td > < td class = "paramname" > < span class = "paramname" > < em > num_threads< / em > < / span >   )< / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Encodes a buffer using Zstandard compression. < / p >
< p > Uses the advanced API (ZSTD_CCtx) to support multi-threaded compression when num_threads > 1. With num_threads < = 1 the output is bit-identical to the simple ZSTD_compress() API.< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > dst_buffer< / td > < td > Pointer to the destination buffer. < / td > < / tr >
< tr > < td class = "paramname" > dst_size< / td > < td > Size of the destination buffer. < / td > < / tr >
< tr > < td class = "paramname" > src_buffer< / td > < td > Pointer to the source (uncompressed) buffer. < / td > < / tr >
< tr > < td class = "paramname" > src_size< / td > < td > Size of the source buffer. < / td > < / tr >
< tr > < td class = "paramname" > level< / td > < td > Compression level (1-22). < / td > < / tr >
< tr > < td class = "paramname" > num_threads< / td > < td > Number of worker threads (1 = single-threaded). < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > Number of compressed bytes, or 0 on error. < / dd > < / dl >
< p class = "definition" > Definition at line < a class = "el" href = "zstd_8c_source.html#l00059" > 59< / a > of file < a class = "el" href = "zstd_8c_source.html" > zstd.c< / a > .< / p >
2026-10-08 20:15:08 +01:00
< p class = "reference" > References < a class = "el" href = "decls_8h_source.html#l00046" > AARU_CALL< / a > , < a class = "el" href = "decls_8h_source.html#l00055" > AARU_EXPORT< / a > , and < a class = "el" href = "zstd_8c_source.html#l00059" > aaruf_zstd_encode_buffer()< / a > .< / p >
2026-04-11 23:17:09 +01:00
2026-10-08 20:15:08 +01:00
< p class = "reference" > Referenced by < a class = "el" href = "write_8c_source.html#l01569" > aaruf_close_current_block()< / a > , < a class = "el" href = "zstd_8c_source.html#l00059" > aaruf_zstd_encode_buffer()< / a > , < a class = "el" href = "ddt__v2_8c_source.html#l01409" > set_ddt_multi_level_v2()< / a > , < a class = "el" href = "close__write_8c_source.html#l02677" > write_bd_sector_edc_block()< / a > , < a class = "el" href = "close__write_8c_source.html#l00070" > write_cached_secondary_ddt()< / a > , < a class = "el" href = "close__write_8c_source.html#l02117" > write_dvd_long_sector_blocks()< / a > , < a class = "el" href = "close__write_8c_source.html#l02890" > write_dvd_title_key_decrypted_block()< / a > , < a class = "el" href = "close__write_8c_source.html#l04907" > write_flux_capture_payload()< / a > , < a class = "el" href = "close__write_8c_source.html#l03087" > write_media_tags()< / a > , < a class = "el" href = "close__write_8c_source.html#l00954" > write_mode2_subheaders_block()< / a > , < a class = "el" href = "close__write_8c_source.html#l01101" > write_sector_prefix()< / a > , < a class = "el" href = "close__write_8c_source.html#l01403" > write_sector_prefix_ddt()< / a > , < a class = "el" href = "close__write_8c_source.html#l01771" > write_sector_subchannel()< / a > , < a class = "el" href = "close__write_8c_source.html#l01254" > write_sector_suffix()< / a > , < a class = "el" href = "close__write_8c_source.html#l01580" > write_sector_suffix_ddt()< / a > , and < a class = "el" href = "close__write_8c_source.html#l00405" > write_single_level_ddt()< / a > .< / p >
2026-04-11 23:17:09 +01:00
< / div >
< / div >
< / div > <!-- contents -->
< / div > <!-- doc - content -->
< div id = "page-nav" class = "page-nav-panel" >
< div id = "page-nav-resize-handle" > < / div >
< div id = "page-nav-tree" >
< div id = "page-nav-contents" >
< / div > <!-- page - nav - contents -->
< / div > <!-- page - nav - tree -->
< / div > <!-- page - nav -->
< / div > <!-- container -->
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
< li class = "navelem" > < a href = "dir_68267d1309a1af8e8297ef4c3efbcdba.html" > src< / a > < / li > < li class = "navelem" > < a href = "dir_40ed6a89610fc2370cf3ffcd6469b940.html" > compression< / a > < / li > < li class = "navelem" > < a href = "zstd_8c.html" > zstd.c< / a > < / li >
2026-10-08 20:15:08 +01:00
< li class = "footer" > Generated by < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.18.0 < / li >
2026-04-11 23:17:09 +01:00
< / ul >
< / div >
< / body >
< / html >