Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Prepare release v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gBillal committed Jun 16, 2023
1 parent 1a93267 commit b6d8a1c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Membrane H265 parser. It is the Membrane element responsible for parsing the incoming h265 stream. The parsing is done as a sequence of the following steps:

* splitting the h265 stream into stream NAL units, based on the "Annex B" of the "ITU-T Rec. H.265 (08/2021)"
* Splitting the h265 stream into stream NAL units, based on the "Annex B" of the "ITU-T Rec. H.265 (08/2021)"
* Parsing the NAL unit headers, so that to read the type of the NAL unit
* Parsing the NAL unit body with the appropriate scheme, based on the NAL unit type read in the step before
* Aggregating the NAL units into a stream of access units
Expand All @@ -16,7 +16,7 @@ The package can be installed by adding `membrane_h265_plugin` to your list of de
```elixir
def deps do
[
{:membrane_template_plugin, github: "gBillal/membrane_h265_plugin", tag: "v0.1.0"}
{:membrane_h265_plugin, "~> 0.1.0"}
]
end
```
21 changes: 10 additions & 11 deletions lib/membrane_h265_plugin/parser/au_splitter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ defmodule Membrane.H265.Parser.AUSplitter do
The access unit splitter's behaviour is based on *"7.4.2.4.4
Order of NAL units and coded pictures and association to access units"*
of the *"ITU-T Rec. H.265 (08/2021)"* specification. The most crucial part
of the access unit splitter is the mechanism to detect new primary coded video picture.
of the *"ITU-T Rec. H.265 (08/2021)"* specification.
The current implementation does not implement all the checks, it splits the nalu into
access units either when a non vcl nalu with type `:vps`, `:sps`, `:pps`, `:aud`, `:prefix_sei` is found
or when the vcl nal unit type <= 9 or between 16 and 25 and has `first_slice_segment_in_pic_flag` is set.
The current implementation splits the nalu into access units either when a non vcl nalu with type
`:vps`, `:sps`, `:pps`, `:aud`, `:prefix_sei` is encountered or when the vcl nal unit type is <= 9 or
between 16 and 25 and has `first_slice_segment_in_pic_flag` is set.
"""
alias Membrane.H265.Parser.{NALu, NALuTypes}

Expand Down Expand Up @@ -59,21 +58,21 @@ defmodule Membrane.H265.Parser.AUSplitter do
@doc """
Splits the given list of NAL units into the access units.
It can be used for a stream which is not completly available at the time of function invoction,
It can be used for a stream which is not completely available at the time of function invocation,
as the function updates the state of the access unit splitter - the function can
be invoked once more, with new NAL units and the updated state.
Under the hood, `split/2` defines a finite state machine
with two states: `:first` and `:second`. The state `:first` describes the state before
reaching the primary coded picture NALu of a given access unit. The state `:second`
describes the state after processing the primary coded picture NALu of a given
reaching the first segment of a coded picture NALu of a given access unit. The state `:second`
describes the state after processing the first segment of the coded picture of a given
access unit.
"""
@spec split(list(NALu.t()), t()) :: {list(access_unit_t()), t()}
def split(nalus, state)

def split([first_nalu | rest_nalus], %{fsm_state: :first} = state) do
cond do
access_unit_first_coded_vcl_nalu?(first_nalu) ->
access_unit_first_slice_segment?(first_nalu) ->
split(
rest_nalus,
%__MODULE__{
Expand Down Expand Up @@ -110,7 +109,7 @@ defmodule Membrane.H265.Parser.AUSplitter do
}
)

access_unit_first_coded_vcl_nalu?(first_nalu) ->
access_unit_first_slice_segment?(first_nalu) ->
split(
rest_nalus,
%__MODULE__{
Expand Down Expand Up @@ -150,7 +149,7 @@ defmodule Membrane.H265.Parser.AUSplitter do
{state.nalus_acc, %{state | nalus_acc: []}}
end

defp access_unit_first_coded_vcl_nalu?(nalu) do
defp access_unit_first_slice_segment?(nalu) do
nalu.type in NALuTypes.vcl_nalu_types() and
nalu.parsed_fields.first_slice_segment_in_pic_flag == 1
end
Expand Down
5 changes: 3 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ defmodule Membrane.Template.Mixfile do

defp package do
[
maintainers: ["Membrane Team"],
maintainers: [],
licenses: ["Apache-2.0"],
links: %{
"GitHub" => @github_url,
Expand All @@ -76,7 +76,8 @@ defmodule Membrane.Template.Mixfile do
extras: ["README.md", "LICENSE"],
formatters: ["html"],
source_ref: "v#{@version}",
nest_modules_by_prefix: [Membrane.Template]
filter_modules: "Membrane\.H265\.Parser",
nest_modules_by_prefix: [Membrane.H265.Parser]
]
end
end

0 comments on commit b6d8a1c

Please sign in to comment.