SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
I Wrote an FFV1 Decoder in Go for Fun:
What I Learned Going from Spec to Implementation
derek@videolan.org
@daemon404
Derek Buitenhuis
5 December 2019
Budapest, Hungary
NTTW4
But… why?
15 December 2019
• Because why not?
• It seemed fun.
• I wanted to see how hard it was to write something while trying not to use anything but a spec.
• Why? How do you spend your weekends? This is normal.
• But mostly: To make the spec better and aid in adoption of free and open codecs and standards.
• More implementations means a better spec.
• Doing it while trying not to reference anything else would expose anything missing or confusing.
NTTW4
You’ll end up reading sections out-of-order
and multiple times
25 December 2019 NTTW4
• Specs are not written in the order you actually have to perform
the steps in, or the order you’ll write them in.
• A second monitor really helps with all the back-and-forth
referencing between your code and the spec.
• Pseudo-code in one section will use variables defined in
other sections / scopes.
Third party implementation is important!
35 December 2019 NTTW4
• There can be many things missing or unclear in a spec until at least one non-author implements it.
• Things that may be obvious or clear to the author
may not be to everyone else.
• The end result is a much more robust, tested spec.
Having background and context in the spec
is extremely useful.
45 December 2019 NTTW4
• Not many ‘professional’ specs have context or background in them, so why something is the
way it is, or important implementation consequences may not be obvious.
• The FFV1 spec has lots of background, and it came in very useful.
Having contact with the spec author(s) is
extremely useful.
55 December 2019 NTTW4
• It’s good to confirm you’re not going crazy trying to figure
something out.
• Lean on the knowledge of those who came before you.
Writing a spec based on an existing
codebase makes for “interesting” specs
65 December 2019 NTTW4
• Lots of the spec bugs I found were assumptions based on FFmpeg’s encoder or
decoder behavior.
• Annoying implications like requiring 17-bit buffers for predicting 16-bit RGB, which are
not spelled out in the spec at all. I hit this right as I finished up.
• On the flip side, the spec also had advice for how to multithread based off of the slice
footers, and other real-world tips.
A bunch of LaTeX math and a paper reference
alone aren’t as good as pseudocode
75 December 2019 NTTW4
• Looking at you range coder.
• Paper was OK, but implementation details were annoying.
• Not gonna lie, I based my implementation off of Wikipedia + FFV1 spec constants.
Some Quick Notes on the Code
85 December 2019 NTTW4
• Not exactly idiomatic Go, in order to remain as close as possible to the spec.
• Goal is be a good reference.
• Everything is annotated with references to
spec sections.
• I used a bit of Perl for code generation…
Links
95 December 2019 NTTW4
• FFV1 Go Implementation: https://github.com/dwbuiten/go-ffv1
• godoc: https://godoc.org/github.com/dwbuiten/go-ffv1/ffv1
• Simple Matroska Go Package: https://github.com/dwbuiten/matroska
• godoc: https://godoc.org/github.com/dwbuiten/matroska
• FFV1 Spec: https://tools.ietf.org/id/draft-ietf-cellar-ffv1-10.html
• FFV1 Repo: https://github.com/FFmpeg/FFV1/
105 December 2019 NTTW4
Questions?

Contenu connexe

Tendances

Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Hannes Lowette
 
Long Life Software
Long Life SoftwareLong Life Software
Long Life SoftwareMike Long
 
mnNOG 3: IP technology adoption in Mongolia
mnNOG 3: IP technology adoption in MongoliamnNOG 3: IP technology adoption in Mongolia
mnNOG 3: IP technology adoption in MongoliaAPNIC
 
Cleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy ProjectsCleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy ProjectsMike Long
 
C++ for Marine Streamer Positioning and Navigation - ACCU 2011
C++ for Marine Streamer Positioning and Navigation - ACCU 2011C++ for Marine Streamer Positioning and Navigation - ACCU 2011
C++ for Marine Streamer Positioning and Navigation - ACCU 2011Mike Long
 
AgileLINC Continous Slides by Daniel Harp
AgileLINC Continous Slides by Daniel HarpAgileLINC Continous Slides by Daniel Harp
AgileLINC Continous Slides by Daniel HarpBarry Gavril
 
Life in Apache Software Foundation
Life in Apache Software FoundationLife in Apache Software Foundation
Life in Apache Software FoundationAshish Singhi
 
Levelling up in open source
Levelling up in open sourceLevelling up in open source
Levelling up in open sourceJon Spriggs
 
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017Codemotion
 
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...Bert Jan Schrijver
 
Bridging the Gap - Laracon 2013
Bridging the Gap - Laracon 2013Bridging the Gap - Laracon 2013
Bridging the Gap - Laracon 2013Ben Corlett
 
Software architecture in a DevOps world
Software architecture in a DevOps worldSoftware architecture in a DevOps world
Software architecture in a DevOps worldBert Jan Schrijver
 
JavaLand 2022 - Debugging distributed systems
JavaLand 2022 - Debugging distributed systemsJavaLand 2022 - Debugging distributed systems
JavaLand 2022 - Debugging distributed systemsBert Jan Schrijver
 
Writing clean and maintainable code
Writing clean and maintainable codeWriting clean and maintainable code
Writing clean and maintainable codeMarko Heijnen
 

Tendances (16)

Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
 
Long Life Software
Long Life SoftwareLong Life Software
Long Life Software
 
mnNOG 3: IP technology adoption in Mongolia
mnNOG 3: IP technology adoption in MongoliamnNOG 3: IP technology adoption in Mongolia
mnNOG 3: IP technology adoption in Mongolia
 
Cleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy ProjectsCleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy Projects
 
C++ for Marine Streamer Positioning and Navigation - ACCU 2011
C++ for Marine Streamer Positioning and Navigation - ACCU 2011C++ for Marine Streamer Positioning and Navigation - ACCU 2011
C++ for Marine Streamer Positioning and Navigation - ACCU 2011
 
AgileLINC Continous Slides by Daniel Harp
AgileLINC Continous Slides by Daniel HarpAgileLINC Continous Slides by Daniel Harp
AgileLINC Continous Slides by Daniel Harp
 
Debugging distributed systems
Debugging distributed systemsDebugging distributed systems
Debugging distributed systems
 
Life in Apache Software Foundation
Life in Apache Software FoundationLife in Apache Software Foundation
Life in Apache Software Foundation
 
Levelling up in open source
Levelling up in open sourceLevelling up in open source
Levelling up in open source
 
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
 
Debugging distributed systems
Debugging distributed systemsDebugging distributed systems
Debugging distributed systems
 
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...
 
Bridging the Gap - Laracon 2013
Bridging the Gap - Laracon 2013Bridging the Gap - Laracon 2013
Bridging the Gap - Laracon 2013
 
Software architecture in a DevOps world
Software architecture in a DevOps worldSoftware architecture in a DevOps world
Software architecture in a DevOps world
 
JavaLand 2022 - Debugging distributed systems
JavaLand 2022 - Debugging distributed systemsJavaLand 2022 - Debugging distributed systems
JavaLand 2022 - Debugging distributed systems
 
Writing clean and maintainable code
Writing clean and maintainable codeWriting clean and maintainable code
Writing clean and maintainable code
 

Similaire à I Wrote an FFV1 Decoder in Go for Fun: What I Learned Going from Spec to Implementation

Developers Best Practices
Developers Best PracticesDevelopers Best Practices
Developers Best Practicesaqib javaid
 
Code smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software OdorsCode smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software OdorsClint Edmonson
 
Engage 2020: Hello are you listening, There is stream for everything
Engage 2020: Hello are you listening, There is stream for everythingEngage 2020: Hello are you listening, There is stream for everything
Engage 2020: Hello are you listening, There is stream for everythingFrank van der Linden
 
How to write maintainable code
How to write maintainable codeHow to write maintainable code
How to write maintainable codePeter Hilton
 
Your Journey to the Uknown: A tale of how I debunk new codebases.
Your Journey to the Uknown: A tale of how I debunk new codebases.Your Journey to the Uknown: A tale of how I debunk new codebases.
Your Journey to the Uknown: A tale of how I debunk new codebases.Ivange Larry Ndumbe
 
AAU UX club presentation - April 23, 2015
AAU UX club presentation - April 23, 2015AAU UX club presentation - April 23, 2015
AAU UX club presentation - April 23, 2015Cassy Rowe
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven developmentEinar Ingebrigtsen
 
Querix 4 gl app analyzer 2016 journey to the center of your 4gl application
Querix 4 gl app analyzer 2016 journey to the center of your 4gl applicationQuerix 4 gl app analyzer 2016 journey to the center of your 4gl application
Querix 4 gl app analyzer 2016 journey to the center of your 4gl applicationBeGooden-IT Consulting
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Derek Jacoby
 
14 Habits of Great SQL Developers
14 Habits of Great SQL Developers14 Habits of Great SQL Developers
14 Habits of Great SQL DevelopersIke Ellis
 
Designing self-service support content – SD Expo Europe 2019
Designing self-service support content – SD Expo Europe 2019Designing self-service support content – SD Expo Europe 2019
Designing self-service support content – SD Expo Europe 2019Richard Ingram
 
Python debuggers slides
Python debuggers slidesPython debuggers slides
Python debuggers slidesmattboehm
 
Internet of Things, TYBSC IT, Semester 5, Unit II
Internet of Things, TYBSC IT, Semester 5, Unit IIInternet of Things, TYBSC IT, Semester 5, Unit II
Internet of Things, TYBSC IT, Semester 5, Unit IIArti Parab Academics
 
Technical Debt - The Code Monster in the Closet
Technical Debt - The Code Monster in the ClosetTechnical Debt - The Code Monster in the Closet
Technical Debt - The Code Monster in the ClosetAll Things Open
 
WordCamp US: Clean Code
WordCamp US: Clean CodeWordCamp US: Clean Code
WordCamp US: Clean Codemtoppa
 
NLJUG speaker academy 2023 - session 1
NLJUG speaker academy 2023 - session 1NLJUG speaker academy 2023 - session 1
NLJUG speaker academy 2023 - session 1Bert Jan Schrijver
 
Code reviews: a short introduction
Code reviews: a short introductionCode reviews: a short introduction
Code reviews: a short introductionFreekDB
 

Similaire à I Wrote an FFV1 Decoder in Go for Fun: What I Learned Going from Spec to Implementation (20)

Developers Best Practices
Developers Best PracticesDevelopers Best Practices
Developers Best Practices
 
Code smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software OdorsCode smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software Odors
 
Engage 2020: Hello are you listening, There is stream for everything
Engage 2020: Hello are you listening, There is stream for everythingEngage 2020: Hello are you listening, There is stream for everything
Engage 2020: Hello are you listening, There is stream for everything
 
How to write maintainable code
How to write maintainable codeHow to write maintainable code
How to write maintainable code
 
Your Journey to the Uknown: A tale of how I debunk new codebases.
Your Journey to the Uknown: A tale of how I debunk new codebases.Your Journey to the Uknown: A tale of how I debunk new codebases.
Your Journey to the Uknown: A tale of how I debunk new codebases.
 
AAU UX club presentation - April 23, 2015
AAU UX club presentation - April 23, 2015AAU UX club presentation - April 23, 2015
AAU UX club presentation - April 23, 2015
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
 
Querix 4 gl app analyzer 2016 journey to the center of your 4gl application
Querix 4 gl app analyzer 2016 journey to the center of your 4gl applicationQuerix 4 gl app analyzer 2016 journey to the center of your 4gl application
Querix 4 gl app analyzer 2016 journey to the center of your 4gl application
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7
 
14 Habits of Great SQL Developers
14 Habits of Great SQL Developers14 Habits of Great SQL Developers
14 Habits of Great SQL Developers
 
Designing self-service support content – SD Expo Europe 2019
Designing self-service support content – SD Expo Europe 2019Designing self-service support content – SD Expo Europe 2019
Designing self-service support content – SD Expo Europe 2019
 
Python debuggers slides
Python debuggers slidesPython debuggers slides
Python debuggers slides
 
Internet of Things, TYBSC IT, Semester 5, Unit II
Internet of Things, TYBSC IT, Semester 5, Unit IIInternet of Things, TYBSC IT, Semester 5, Unit II
Internet of Things, TYBSC IT, Semester 5, Unit II
 
Traits of a Good Engineer
Traits of a Good EngineerTraits of a Good Engineer
Traits of a Good Engineer
 
Handsome UI KIts
Handsome UI KItsHandsome UI KIts
Handsome UI KIts
 
Technical Debt - The Code Monster in the Closet
Technical Debt - The Code Monster in the ClosetTechnical Debt - The Code Monster in the Closet
Technical Debt - The Code Monster in the Closet
 
WordCamp US: Clean Code
WordCamp US: Clean CodeWordCamp US: Clean Code
WordCamp US: Clean Code
 
Are Video Codecs... Done?
Are Video Codecs... Done?Are Video Codecs... Done?
Are Video Codecs... Done?
 
NLJUG speaker academy 2023 - session 1
NLJUG speaker academy 2023 - session 1NLJUG speaker academy 2023 - session 1
NLJUG speaker academy 2023 - session 1
 
Code reviews: a short introduction
Code reviews: a short introductionCode reviews: a short introduction
Code reviews: a short introduction
 

Plus de Derek Buitenhuis

Colorspace: Useful For More Than Just Color? - SF Video Tech Meetup - 27 May ...
Colorspace: Useful For More Than Just Color? - SF Video Tech Meetup - 27 May ...Colorspace: Useful For More Than Just Color? - SF Video Tech Meetup - 27 May ...
Colorspace: Useful For More Than Just Color? - SF Video Tech Meetup - 27 May ...Derek Buitenhuis
 
A Progressive Approach to the Past: Ensuring Backwards Compatability Through ...
A Progressive Approach to the Past: Ensuring Backwards Compatability Through ...A Progressive Approach to the Past: Ensuring Backwards Compatability Through ...
A Progressive Approach to the Past: Ensuring Backwards Compatability Through ...Derek Buitenhuis
 
Let's Be HAV1ng You - London Video Tech October 2019
Let's Be HAV1ng You - London Video Tech October 2019Let's Be HAV1ng You - London Video Tech October 2019
Let's Be HAV1ng You - London Video Tech October 2019Derek Buitenhuis
 
Vimeo and Open Source (SMPTE Forum 2015)
Vimeo and Open Source (SMPTE Forum 2015)Vimeo and Open Source (SMPTE Forum 2015)
Vimeo and Open Source (SMPTE Forum 2015)Derek Buitenhuis
 
Let's Write a JPEG Decoder (Vimeo Lunch Talks)
Let's Write a JPEG Decoder (Vimeo Lunch Talks)Let's Write a JPEG Decoder (Vimeo Lunch Talks)
Let's Write a JPEG Decoder (Vimeo Lunch Talks)Derek Buitenhuis
 
FFMS2: Indexing, Edge Cases, and Insanity
FFMS2: Indexing, Edge Cases, and InsanityFFMS2: Indexing, Edge Cases, and Insanity
FFMS2: Indexing, Edge Cases, and InsanityDerek Buitenhuis
 
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...Derek Buitenhuis
 
Things Developers Believe About Video Files (Proven Wrong by User Uploads)
Things Developers Believe About Video Files (Proven Wrong by User Uploads)Things Developers Believe About Video Files (Proven Wrong by User Uploads)
Things Developers Believe About Video Files (Proven Wrong by User Uploads)Derek Buitenhuis
 

Plus de Derek Buitenhuis (8)

Colorspace: Useful For More Than Just Color? - SF Video Tech Meetup - 27 May ...
Colorspace: Useful For More Than Just Color? - SF Video Tech Meetup - 27 May ...Colorspace: Useful For More Than Just Color? - SF Video Tech Meetup - 27 May ...
Colorspace: Useful For More Than Just Color? - SF Video Tech Meetup - 27 May ...
 
A Progressive Approach to the Past: Ensuring Backwards Compatability Through ...
A Progressive Approach to the Past: Ensuring Backwards Compatability Through ...A Progressive Approach to the Past: Ensuring Backwards Compatability Through ...
A Progressive Approach to the Past: Ensuring Backwards Compatability Through ...
 
Let's Be HAV1ng You - London Video Tech October 2019
Let's Be HAV1ng You - London Video Tech October 2019Let's Be HAV1ng You - London Video Tech October 2019
Let's Be HAV1ng You - London Video Tech October 2019
 
Vimeo and Open Source (SMPTE Forum 2015)
Vimeo and Open Source (SMPTE Forum 2015)Vimeo and Open Source (SMPTE Forum 2015)
Vimeo and Open Source (SMPTE Forum 2015)
 
Let's Write a JPEG Decoder (Vimeo Lunch Talks)
Let's Write a JPEG Decoder (Vimeo Lunch Talks)Let's Write a JPEG Decoder (Vimeo Lunch Talks)
Let's Write a JPEG Decoder (Vimeo Lunch Talks)
 
FFMS2: Indexing, Edge Cases, and Insanity
FFMS2: Indexing, Edge Cases, and InsanityFFMS2: Indexing, Edge Cases, and Insanity
FFMS2: Indexing, Edge Cases, and Insanity
 
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...
Every Solution is Wrong: Normalizing Ambiguous, Broken, and Pants-on-Head Cra...
 
Things Developers Believe About Video Files (Proven Wrong by User Uploads)
Things Developers Believe About Video Files (Proven Wrong by User Uploads)Things Developers Believe About Video Files (Proven Wrong by User Uploads)
Things Developers Believe About Video Files (Proven Wrong by User Uploads)
 

Dernier

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 

Dernier (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

I Wrote an FFV1 Decoder in Go for Fun: What I Learned Going from Spec to Implementation

  • 1. I Wrote an FFV1 Decoder in Go for Fun: What I Learned Going from Spec to Implementation derek@videolan.org @daemon404 Derek Buitenhuis 5 December 2019 Budapest, Hungary NTTW4
  • 2. But… why? 15 December 2019 • Because why not? • It seemed fun. • I wanted to see how hard it was to write something while trying not to use anything but a spec. • Why? How do you spend your weekends? This is normal. • But mostly: To make the spec better and aid in adoption of free and open codecs and standards. • More implementations means a better spec. • Doing it while trying not to reference anything else would expose anything missing or confusing. NTTW4
  • 3. You’ll end up reading sections out-of-order and multiple times 25 December 2019 NTTW4 • Specs are not written in the order you actually have to perform the steps in, or the order you’ll write them in. • A second monitor really helps with all the back-and-forth referencing between your code and the spec. • Pseudo-code in one section will use variables defined in other sections / scopes.
  • 4. Third party implementation is important! 35 December 2019 NTTW4 • There can be many things missing or unclear in a spec until at least one non-author implements it. • Things that may be obvious or clear to the author may not be to everyone else. • The end result is a much more robust, tested spec.
  • 5. Having background and context in the spec is extremely useful. 45 December 2019 NTTW4 • Not many ‘professional’ specs have context or background in them, so why something is the way it is, or important implementation consequences may not be obvious. • The FFV1 spec has lots of background, and it came in very useful.
  • 6. Having contact with the spec author(s) is extremely useful. 55 December 2019 NTTW4 • It’s good to confirm you’re not going crazy trying to figure something out. • Lean on the knowledge of those who came before you.
  • 7. Writing a spec based on an existing codebase makes for “interesting” specs 65 December 2019 NTTW4 • Lots of the spec bugs I found were assumptions based on FFmpeg’s encoder or decoder behavior. • Annoying implications like requiring 17-bit buffers for predicting 16-bit RGB, which are not spelled out in the spec at all. I hit this right as I finished up. • On the flip side, the spec also had advice for how to multithread based off of the slice footers, and other real-world tips.
  • 8. A bunch of LaTeX math and a paper reference alone aren’t as good as pseudocode 75 December 2019 NTTW4 • Looking at you range coder. • Paper was OK, but implementation details were annoying. • Not gonna lie, I based my implementation off of Wikipedia + FFV1 spec constants.
  • 9. Some Quick Notes on the Code 85 December 2019 NTTW4 • Not exactly idiomatic Go, in order to remain as close as possible to the spec. • Goal is be a good reference. • Everything is annotated with references to spec sections. • I used a bit of Perl for code generation…
  • 10. Links 95 December 2019 NTTW4 • FFV1 Go Implementation: https://github.com/dwbuiten/go-ffv1 • godoc: https://godoc.org/github.com/dwbuiten/go-ffv1/ffv1 • Simple Matroska Go Package: https://github.com/dwbuiten/matroska • godoc: https://godoc.org/github.com/dwbuiten/matroska • FFV1 Spec: https://tools.ietf.org/id/draft-ietf-cellar-ffv1-10.html • FFV1 Repo: https://github.com/FFmpeg/FFV1/
  • 11. 105 December 2019 NTTW4 Questions?