Skip to content

Commit

Permalink
10
Browse files Browse the repository at this point in the history
  • Loading branch information
umerov1999 committed Feb 1, 2023
1 parent 3e21acc commit 5c82c30
Show file tree
Hide file tree
Showing 79 changed files with 678 additions and 136 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<b>Инструкция по сборке:</b>
Требуется:
1) Android Studio Electric Eel (2022.1.1) или выше. Kotlin 1.8.*
1) Android Studio Flamingo (2022.2.1) или выше. Kotlin 1.8.*
2) Android SDK 33
3) Android NDK 25.1.8937393

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {

ext.appCompileSDK = 33
ext.appBuildTools = "33.0.1"
ext.appNdk = "25.1.8937393"
ext.appNdk = "25.2.9519653"
ext.appMinSDK = is_developer_build ? 29 : 21
ext.appTargetSDK = 31
ext.appFenrirVersionCode = 999
Expand Down
Binary file removed compiled_native/libfenrir-release.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion libfenrir/ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rm -r -f ".git"

ENABLED_DECODERS=(gif mpeg4 h264 hevc mp3 aac ac3 eac3 flac vorbis alac)
HOST_PLATFORM="linux-x86_64"
NDK_PATH="/home/umerov/Android/Sdk/ndk/25.1.8937393"
NDK_PATH="/home/umerov/Android/Sdk/ndk/25.2.9519653"

echo 'Please input platform version (Example 21 - Android 5.0): '
read ANDROID_PLATFORM
Expand Down
44 changes: 31 additions & 13 deletions libfenrir/src/main/jni/compress/zstd/compress/zstd_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,8 @@ static ZSTD_paramSwitch_e ZSTD_resolveEnableLdm(ZSTD_paramSwitch_e mode,
return (cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 27) ? ZSTD_ps_enable : ZSTD_ps_disable;
}

/* Enables validation for external sequences in debug builds. */
static int ZSTD_resolveExternalSequenceValidation(int mode) {
#if defined(DEBUGLEVEL) && (DEBUGLEVEL>=2)
(void)mode;
return 1;
#else
return mode;
#endif
}

/* Resolves maxBlockSize to the default if no value is present. */
Expand Down Expand Up @@ -3050,6 +3044,23 @@ static size_t ZSTD_postProcessExternalMatchFinderResult(
}
}

/* ZSTD_fastSequenceLengthSum() :
* Returns sum(litLen) + sum(matchLen) + lastLits for *seqBuf*.
* Similar to another function in zstd_compress.c (determine_blockSize),
* except it doesn't check for a block delimiter to end summation.
* Removing the early exit allows the compiler to auto-vectorize (https://godbolt.org/z/cY1cajz9P).
* This function can be deleted and replaced by determine_blockSize after we resolve issue #3456. */
static size_t ZSTD_fastSequenceLengthSum(ZSTD_Sequence const* seqBuf, size_t seqBufSize) {
size_t matchLenSum, litLenSum, i;
matchLenSum = 0;
litLenSum = 0;
for (i = 0; i < seqBufSize; i++) {
litLenSum += seqBuf[i].litLength;
matchLenSum += seqBuf[i].matchLength;
}
return litLenSum + matchLenSum;
}

typedef enum { ZSTDbss_compress, ZSTDbss_noCompress } ZSTD_buildSeqStore_e;

static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize)
Expand Down Expand Up @@ -3167,8 +3178,15 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize)
/* Return early if there is no error, since we don't need to worry about last literals */
if (!ZSTD_isError(nbPostProcessedSeqs)) {
ZSTD_sequencePosition seqPos = {0,0,0};
ZSTD_copySequencesToSeqStoreExplicitBlockDelim(
zc, &seqPos, zc->externalMatchCtx.seqBuffer, nbPostProcessedSeqs, src, srcSize
size_t const seqLenSum = ZSTD_fastSequenceLengthSum(zc->externalMatchCtx.seqBuffer, nbPostProcessedSeqs);
RETURN_ERROR_IF(seqLenSum > srcSize, externalSequences_invalid, "External sequences imply too large a block!");
FORWARD_IF_ERROR(
ZSTD_copySequencesToSeqStoreExplicitBlockDelim(
zc, &seqPos,
zc->externalMatchCtx.seqBuffer, nbPostProcessedSeqs,
src, srcSize
),
"Failed to copy external sequences to seqStore!"
);
ms->ldmSeqStore = NULL;
DEBUGLOG(5, "Copied %lu sequences from external matchfinder to internal seqStore.", (unsigned long)nbExternalSeqs);
Expand Down Expand Up @@ -6286,7 +6304,7 @@ ZSTD_copySequencesToSeqStoreExplicitBlockDelim(ZSTD_CCtx* cctx,
ip += inSeqs[idx].litLength;
seqPos->posInSrc += inSeqs[idx].litLength;
}
RETURN_ERROR_IF(ip != iend, corruption_detected, "Blocksize doesn't agree with block delimiter!");
RETURN_ERROR_IF(ip != iend, externalSequences_invalid, "Blocksize doesn't agree with block delimiter!");
seqPos->idx = idx+1;
return 0;
}
Expand Down Expand Up @@ -6444,13 +6462,13 @@ blockSize_explicitDelimiter(const ZSTD_Sequence* inSeqs, size_t inSeqsSize, ZSTD
blockSize += inSeqs[spos].litLength + inSeqs[spos].matchLength;
if (end) {
if (inSeqs[spos].matchLength != 0)
RETURN_ERROR(corruption_detected, "delimiter format error : both matchlength and offset must be == 0");
RETURN_ERROR(externalSequences_invalid, "delimiter format error : both matchlength and offset must be == 0");
break;
}
spos++;
}
if (!end)
RETURN_ERROR(corruption_detected, "Reached end of sequences without finding a block delimiter");
RETURN_ERROR(externalSequences_invalid, "Reached end of sequences without finding a block delimiter");
return blockSize;
}

Expand All @@ -6471,9 +6489,9 @@ static size_t determine_blockSize(ZSTD_sequenceFormat_e mode,
{ size_t const explicitBlockSize = blockSize_explicitDelimiter(inSeqs, inSeqsSize, seqPos);
FORWARD_IF_ERROR(explicitBlockSize, "Error while determining block size with explicit delimiters");
if (explicitBlockSize > blockSize)
RETURN_ERROR(corruption_detected, "sequences incorrectly define a too large block");
RETURN_ERROR(externalSequences_invalid, "sequences incorrectly define a too large block");
if (explicitBlockSize > remaining)
RETURN_ERROR(srcSize_wrong, "sequences define a frame longer than source");
RETURN_ERROR(externalSequences_invalid, "sequences define a frame longer than source");
return explicitBlockSize;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION_CODES;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.widget.Toolbar;
import android.util.AttributeSet;
import android.util.Pair;
import android.view.Menu;
import android.view.View;
import android.view.View.MeasureSpec;
import android.widget.ImageView;
Expand Down Expand Up @@ -127,6 +129,19 @@ public MaterialToolbar(@NonNull Context context, @Nullable AttributeSet attrs, i
initBackground(context);
}

@Override
public void inflateMenu(int i) {
// Pause dispatching item changes during inflation to improve performance.
Menu menu = getMenu();
if (menu instanceof MenuBuilder) {
((MenuBuilder) menu).stopDispatchingItemsChanged();
}
super.inflateMenu(i);
if (menu instanceof MenuBuilder) {
((MenuBuilder) menu).startDispatchingItemsChanged();
}
}

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<item
android:state_enabled="true"
app:state_lifted="false"
app:state_liftable="true">
<objectAnimator
android:duration="@integer/app_bar_elevation_anim_duration"
android:propertyName="elevation"
android:valueTo="@dimen/m3_comp_top_app_bar_small_container_elevation"
android:valueType="floatType"/>
</item>

<item android:state_enabled="true">
<objectAnimator
android:duration="@integer/app_bar_elevation_anim_duration"
android:propertyName="elevation"
android:valueTo="@dimen/m3_comp_top_app_bar_small_on_scroll_container_elevation"
android:valueType="floatType"/>
</item>

<item>
<objectAnimator
android:duration="0"
android:propertyName="elevation"
android:valueTo="@dimen/m3_comp_top_app_bar_small_container_elevation"
android:valueType="floatType"/>
</item>

</selector>
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

<dimen name="mtrl_toolbar_default_height">56dp</dimen>

<dimen name="m3_appbar_size_compact">64dp</dimen>
<dimen name="m3_appbar_size_medium">112dp</dimen>
<dimen name="m3_appbar_size_large">152dp</dimen>
<dimen name="m3_appbar_size_compact">@dimen/m3_comp_top_app_bar_small_container_height</dimen>
<dimen name="m3_appbar_size_medium">@dimen/m3_comp_top_app_bar_medium_container_height</dimen>
<dimen name="m3_appbar_size_large">@dimen/m3_comp_top_app_bar_large_container_height</dimen>

<dimen name="m3_appbar_expanded_title_margin_horizontal">16dp</dimen>
<dimen name="m3_appbar_expanded_title_margin_bottom">16dp</dimen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@
<!-- M3 AppBarLayout styles -->
<style name="Widget.Material3.AppBarLayout" parent="Widget.MaterialComponents.AppBarLayout.Surface">
<item name="liftOnScroll">true</item>
<item name="android:background">@macro/m3_comp_top_app_bar_small_container_color</item>
<item name="android:stateListAnimator" tools:ignore="NewApi">
@animator/m3_appbar_state_list_animator
</item>

<!-- On newer API levels, hide shadows while keeping elevation. -->
<item name="android:outlineAmbientShadowColor" tools:ignore="NewApi">@android:color/transparent</item>
Expand All @@ -157,9 +161,9 @@

<!-- M3 CollapsingToolbarLayout styles -->
<style name="Base.Widget.Material3.CollapsingToolbar" parent="Widget.MaterialComponents.CollapsingToolbar">
<item name="collapsedTitleTextAppearance">?attr/textAppearanceTitleLarge</item>
<item name="collapsedTitleTextColor">?attr/colorOnSurface</item>
<item name="expandedTitleTextColor">?attr/colorOnSurface</item>
<item name="collapsedTitleTextAppearance">@macro/m3_comp_top_app_bar_small_headline_type</item>
<item name="collapsedTitleTextColor">@macro/m3_comp_top_app_bar_small_headline_color</item>
<item name="expandedTitleTextColor">@macro/m3_comp_top_app_bar_small_headline_color</item>
<item name="expandedTitleMarginStart">@dimen/m3_appbar_expanded_title_margin_horizontal</item>
<item name="expandedTitleMarginEnd">@dimen/m3_appbar_expanded_title_margin_horizontal</item>
<item name="expandedTitleMarginBottom">@dimen/m3_appbar_expanded_title_margin_bottom</item>
Expand All @@ -181,17 +185,21 @@

<style name="Widget.Material3.CollapsingToolbar.Medium" parent="Base.Widget.Material3.CollapsingToolbar">
<item name="scrimVisibleHeightTrigger">@dimen/m3_appbar_scrim_height_trigger_medium</item>
<item name="expandedTitleTextAppearance">?attr/textAppearanceHeadlineSmall</item>
<item name="collapsedTitleTextColor">@macro/m3_comp_top_app_bar_medium_headline_color</item>
<item name="expandedTitleTextColor">@macro/m3_comp_top_app_bar_medium_headline_color</item>
<item name="expandedTitleTextAppearance">@macro/m3_comp_top_app_bar_medium_headline_type</item>
</style>

<style name="Widget.Material3.CollapsingToolbar.Large" parent="Base.Widget.Material3.CollapsingToolbar">
<item name="scrimVisibleHeightTrigger">@dimen/m3_appbar_scrim_height_trigger_large</item>
<item name="expandedTitleTextAppearance">?attr/textAppearanceHeadlineMedium</item>
<item name="collapsedTitleTextColor">@macro/m3_comp_top_app_bar_large_headline_color</item>
<item name="expandedTitleTextColor">@macro/m3_comp_top_app_bar_large_headline_color</item>
<item name="expandedTitleTextAppearance">@macro/m3_comp_top_app_bar_large_headline_type</item>
</style>

<!-- Style for a M3 Toolbar. -->
<style name="Widget.Material3.Toolbar" parent="Widget.AppCompat.Toolbar">
<item name="titleTextAppearance">?attr/textAppearanceTitleLarge</item>
<item name="titleTextAppearance">@macro/m3_comp_top_app_bar_small_headline_type</item>
<item name="subtitleTextAppearance">?attr/textAppearanceTitleMedium</item>
<item name="contentInsetStartWithNavigation">0dp</item>

Expand All @@ -204,57 +212,57 @@
colors for text and iconography). Use with MaterialToolbar to get
navigation icon and menu icon coloring. -->
<style name="Widget.Material3.Toolbar.OnSurface">
<item name="titleTextColor">?attr/colorOnSurface</item>
<item name="titleTextColor">@macro/m3_comp_top_app_bar_small_headline_color</item>
<item name="subtitleTextColor">?attr/colorOnSurfaceVariant</item>
<item name="navigationIconTint">?attr/colorOnSurface</item>
<item name="navigationIconTint">@macro/m3_comp_top_app_bar_small_leading_icon_color</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.Material3.Toolbar.Surface</item>
</style>

<!-- Style for a M3 Surface Toolbar (surface background and on-surface
colors for text and iconography). Use with MaterialToolbar to get
navigation icon and menu icon coloring. -->
<style name="Widget.Material3.Toolbar.Surface" parent="Widget.Material3.Toolbar.OnSurface">
<item name="android:background">?attr/colorSurface</item>
<item name="android:background">@macro/m3_comp_top_app_bar_small_container_color</item>
</style>

<style name="ThemeOverlay.Material3.Toolbar.Surface" parent="">
<item name="actionMenuTextColor">?attr/colorOnSurfaceVariant</item>
<item name="colorControlNormal">?attr/colorOnSurfaceVariant</item>
<item name="actionMenuTextColor">@macro/m3_comp_top_app_bar_small_trailing_icon_color</item>
<item name="colorControlNormal">@macro/m3_comp_top_app_bar_small_trailing_icon_color</item>
</style>

<!-- Style for a M3 ActionBar (inherited from AppCompat due to different
desired configuration compared to MaterialComponents ActionBars). -->
<style name="Base.Widget.Material3.ActionBar.Solid" parent="Widget.AppCompat.ActionBar.Solid">
<item name="titleTextStyle">@style/TextAppearance.Material3.ActionBar.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Material3.ActionBar.Subtitle</item>
<item name="background">?attr/colorSurface</item>
<item name="backgroundStacked">?attr/colorSurface</item>
<item name="backgroundSplit">?attr/colorSurface</item>
<item name="background">@macro/m3_comp_top_app_bar_small_container_color</item>
<item name="backgroundStacked">@macro/m3_comp_top_app_bar_small_container_color</item>
<item name="backgroundSplit">@macro/m3_comp_top_app_bar_small_container_color</item>
</style>

<style name="Widget.Material3.ActionBar.Solid" parent="Base.Widget.Material3.ActionBar.Solid" />

<style name="Base.Widget.Material3.Light.ActionBar.Solid" parent="Widget.AppCompat.Light.ActionBar.Solid">
<item name="titleTextStyle">@style/TextAppearance.Material3.ActionBar.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Material3.ActionBar.Subtitle</item>
<item name="background">?attr/colorSurface</item>
<item name="backgroundStacked">?attr/colorSurface</item>
<item name="backgroundSplit">?attr/colorSurface</item>
<item name="background">@macro/m3_comp_top_app_bar_small_container_color</item>
<item name="backgroundStacked">@macro/m3_comp_top_app_bar_small_container_color</item>
<item name="backgroundSplit">@macro/m3_comp_top_app_bar_small_container_color</item>
</style>

<style name="Widget.Material3.Light.ActionBar.Solid" parent="Base.Widget.Material3.Light.ActionBar.Solid" />

<style name="Base.Widget.Material3.ActionMode" parent="Widget.AppCompat.ActionMode">
<item name="titleTextStyle">@style/TextAppearance.Material3.ActionBar.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Material3.ActionBar.Subtitle</item>
<item name="background">?attr/colorSurface</item>
<item name="backgroundSplit">?attr/colorSurface</item>
<item name="background">@macro/m3_comp_top_app_bar_small_container_color</item>
<item name="backgroundSplit">@macro/m3_comp_top_app_bar_small_container_color</item>
</style>

<style name="Widget.Material3.ActionMode" parent="Base.Widget.Material3.ActionMode" />

<style name="TextAppearance.Material3.ActionBar.Title" parent="TextAppearance.Material3.TitleLarge">
<item name="android:textColor">?attr/colorOnSurface</item>
<item name="android:textColor">@macro/m3_comp_top_app_bar_small_headline_color</item>
</style>

<style name="TextAppearance.Material3.ActionBar.Subtitle" parent="TextAppearance.Material3.TitleMedium">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- AUTOGENERATED FILE. DO NOT MODIFY. -->
<!-- Version: v0.147 -->

<resources>

<!-- Generated from token set (md.comp.top-app-bar.small) in context (platform=android, audience=3p). -->
<!-- Enabled - Container -->
<macro name="m3_comp_top_app_bar_small_container_color">?attr/colorSurface</macro>
<dimen name="m3_comp_top_app_bar_small_container_height">64dp</dimen>
<dimen name="m3_comp_top_app_bar_small_container_elevation">@dimen/m3_sys_elevation_level0</dimen>
<!-- Enabled - Leading icon -->
<macro name="m3_comp_top_app_bar_small_leading_icon_color">?attr/colorOnSurface</macro>
<!-- Enabled - Trailing icon -->
<macro name="m3_comp_top_app_bar_small_trailing_icon_color">?attr/colorOnSurfaceVariant</macro>
<!-- Enabled - Headline -->
<macro name="m3_comp_top_app_bar_small_headline_type">?attr/textAppearanceTitleLarge</macro>
<macro name="m3_comp_top_app_bar_small_headline_color">?attr/colorOnSurface</macro>
<!-- Enabled - On scroll -->
<dimen name="m3_comp_top_app_bar_small_on_scroll_container_elevation">@dimen/m3_sys_elevation_level2</dimen>

<!-- Generated from token set (md.comp.top-app-bar.medium) in context (platform=android, audience=3p). -->
<!-- Enabled - Container -->
<dimen name="m3_comp_top_app_bar_medium_container_height">112dp</dimen>
<!-- Enabled - Headline -->
<macro name="m3_comp_top_app_bar_medium_headline_type">?attr/textAppearanceHeadlineSmall</macro>
<macro name="m3_comp_top_app_bar_medium_headline_color">?attr/colorOnSurface</macro>

<!-- Generated from token set (md.comp.top-app-bar.large) in context (platform=android, audience=3p). -->
<!-- Enabled - Container -->
<dimen name="m3_comp_top_app_bar_large_container_height">152dp</dimen>
<!-- Enabled - Headline -->
<macro name="m3_comp_top_app_bar_large_headline_type">?attr/textAppearanceHeadlineMedium</macro>
<macro name="m3_comp_top_app_bar_large_headline_color">?attr/colorOnSurface</macro>

</resources>
Loading

0 comments on commit 5c82c30

Please sign in to comment.