-
Notifications
You must be signed in to change notification settings - Fork 364
feat: Add Korean translation for assembly lessons #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
evenharder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fully appreciate your endeavor for translating this marvelous material in Korean! Here are some minor comments and suggestions.
lesson_01/index.ko.md
Outdated
|
|
||
| ## 왜 어셈블리어를 사용하나요? | ||
|
|
||
| 결론부터 말씀드리자면 멀티미디어를 빠르게 처리하기 위해서입니다. 어셈블리어로 작성된 코드는 10배 이상의 속도 향상을 가져오는 경향이 있으며, 특히 실시간으로 끊김 없는 영상을 재생하려는 경우에 특히 중요합니다. 추가로 에너지 소비를 줄이고 배터리 수명을 늘리는 데도 도움이 됩니다. 비디오 인코딩 및 디코딩 기능은 대기업의 데이터센터를 포함한 일반 사용자 모두에게 지구상에서 가장 많이 사용되는 기능 중 일부라는 점을 강조하고 싶습니다. 따라서 작은 개선도 빠르게 누적됩니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the phrase 가장 많이 사용되는 기능 중 일부, '하나' instead of '일부' seems natural.
lesson_01/index.ko.md
Outdated
| 결론부터 말씀드리자면 멀티미디어를 빠르게 처리하기 위해서입니다. 어셈블리어로 작성된 코드는 10배 이상의 속도 향상을 가져오는 경향이 있으며, 특히 실시간으로 끊김 없는 영상을 재생하려는 경우에 특히 중요합니다. 추가로 에너지 소비를 줄이고 배터리 수명을 늘리는 데도 도움이 됩니다. 비디오 인코딩 및 디코딩 기능은 대기업의 데이터센터를 포함한 일반 사용자 모두에게 지구상에서 가장 많이 사용되는 기능 중 일부라는 점을 강조하고 싶습니다. 따라서 작은 개선도 빠르게 누적됩니다. | ||
|
|
||
| <!-- online과 intrisics를 어떻게 번역할지 grocery를 정한 다음 수정을 할 필요가 있음. --> | ||
| 주변(online)에서는 intrinsics(내장 함수)을 사용하는걸 흔하게 볼 수 있습니다. 이는 어셈블리 명령어에 매핑되는 C 스타일 함수로, 주로 개발 속도를 높이기 위해 사용됩니다. 하지만 FFmpeg에서는 이러한 intrinsic을 사용하지 않고 어셈블리어 코드를 직접 작성합니다. 이 부분에 대해선 논쟁이 있지만, 컴파일러에 따라 일반적으로 intri은sics는 수작업으로 작성된 어셈블리 코드보다 약 10~15% 정도 느린 것으로 알려져 있습니다. FFmpeg에서는 가능한 모든 성능을 끌어내는 것이 중요하기 때문에, intrinsic에 의존하지 않는 방식을 택하고 있습니다 (옹호자들은 동의하지 않겠지만요). 또한 intrinsic은 변수에 [헝가리안 표기법](https://en.wikipedia.org/wiki/Hungarian_notation)을 사용하고 있기 때문에 읽기 어렵다는 의견도 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explanation in parentheses should be moved to the former sentence to match with the original.
Also, there is an apparent typo intri은sics는.
lesson_01/index.ko.md
Outdated
| imul r0q, 5 | ||
| ``` | ||
|
|
||
| 첫 번째 줄에서는 즉시 `3`(메모리에서 읽어온 값이 아닌 코드 자체에 저장된 값)을 레지스터 `r0`에 쿼드워드(64비트) 크기로 저장합니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the term immediate is a noun here, it should be represented as 즉시값.
lesson_01/index.ko.md
Outdated
|
|
||
| ## 소개 | ||
|
|
||
| FFmpeg 어셈블리어 학교에 오신걸 환영합니다. 여러분은 프로그래밍에서 가장 흥미로우면서 도전적이고 보람도 있는 여정의 첫걸음을 내디디셨습니다. 이 강의들은 FFmpeg에서 어셈블리어가 어떻게 사용되는지, 그리고 여러분들의 컴퓨터에서 실제로는 어떤 일이 일어나고 있는지 단초를 제공해줄 것입니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 오신걸 → 오신 걸
이 강의들은 FFmpeg에서 어셈블리어가 어떻게 사용되는지, 그리고 여러분들의 컴퓨터에서 실제로는 어떤 일이 일어나고 있는지 단초를 제공해줄 것입니다.
Original: These lessons will give you a grounding in the way assembly language is written in FFmpeg and open your eyes to what's actually going on in your computer.
I suggest "이 강의를 통해 여러분은 FFmpeg에서 어셈블리어 코드를 작성하는 방법의 기초를 배우고, 컴퓨터에서 실제로는 어떤 일이 일어나고 있는지에 눈뜨게 될 것입니다."
Changes:
- This text focuses on reader's gain. I feel it more natural in Korean to write in reader's active voice.
- 단초를 제공해줄 것입니다 seems like a direct translation of "give you a grounding in", but the counterpart for "open your eyes to" is missing.
- The author wrote "the way assembly language is written", not "used". This is about syntax, code styles, or rules (so "작성"), not about how FFmpeg utilizes things ("사용") written in assembly language.
lesson_01/index.ko.md
Outdated
| ## 사전 지식 | ||
|
|
||
| - C 언어 지식, 특히 포인터에 대한 이해가 필요합니다. 만약 아직 C에 익숙하지 않다면 [The C Programming Language](https://en.wikipedia.org/wiki/The_C_Programming_Language) 책을 참고하세요. | ||
| - 고등학교 수학 (스칼라 vs 벡터 덧셈, 곱셈 등) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: Should be 스칼라 vs 벡터, 덧셈, 곱셈 등
lesson_01/index.ko.md
Outdated
|
|
||
| 어셈블리어는 CPU가 처리하는 명령어와 직접 대응하는 코드를 작성하는 프로그래밍 언어입니다. 사람이 읽을 수 있는 형태의 어셈블리어는 이름 그대로 '조립(assemble)'되어 CPU가 이해할 수 있는 이진 데이터, 즉 머신 코드(machine code)로 변환됩니다. 어셈블리어 코드는 종종 "어셈블리" 또는 "asm"으로 불립니다. | ||
|
|
||
| FFmpeg에서 사용되는 대부분의 어셈블리 코드는 단일 명령 다중 데이터 방식인 SIMD(Single Instruction Multiple Data)로 작성되어 있습니다. SIMD는 종종 벡터 프로그래밍(vector programming)이라고도 불립니다. 이 방식은 하나의 명령어가 동시에 여러 데이터 요소를 처리할 수 있게 해줍니다. 반면 대부분의 프로그래밍 언어는 한 번에 하나의 데이터만 처리하는 스칼라 프로그래밍(scalar programming) 방식입니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FFmpeg에서 사용되는 대부분의 어셈블리 코드는 단일 명령 다중 데이터 방식인 SIMD(Single Instruction Multiple Data)로 작성되어 있습니다.
Original: The vast majority of assembly code in FFmpeg is what's known as SIMD, Single Instruction Multiple Data.
I suggest "FFmpeg에서 사용되는 대부분의 어셈블리어 코드는 SIMD(단일 명령어 다중 데이터)로 작성되어 있습니다."
"단일 명령어 다중 데이터" and "SIMD" are the same object. "단일 명령 다중 데이터 방식인 SIMD" reads as if SIMD is one of a such kind.
lesson_01/index.ko.md
Outdated
|
|
||
| FFmpeg에서 사용되는 대부분의 어셈블리 코드는 단일 명령 다중 데이터 방식인 SIMD(Single Instruction Multiple Data)로 작성되어 있습니다. SIMD는 종종 벡터 프로그래밍(vector programming)이라고도 불립니다. 이 방식은 하나의 명령어가 동시에 여러 데이터 요소를 처리할 수 있게 해줍니다. 반면 대부분의 프로그래밍 언어는 한 번에 하나의 데이터만 처리하는 스칼라 프로그래밍(scalar programming) 방식입니다. | ||
|
|
||
| 짐작하셨겠지만, SIMD는 이미지, 비디오 그리고 오디오처럼 메모리에 연속적으로 정렬된 대량의 데이터를 처리할 때 매우 효과적입니다. 이러한 순차적 데이터를 효율적으로 처리하기 위해 CPU에는 특수한 명령어들이 내장되어 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Original: As you might have guessed, SIMD lends itself well to processing images, video, and audio which have lots of data ordered sequentially in memory. There are specialist instructions available in the CPU to help us process sequential data.
I suggest "짐작하셨겠지만, SIMD는 이미지, 비디오, 오디오처럼 데이터의 대부분이 메모리에 연속적으로 정렬되어 있을 때 매우 효과적입니다. CPU에는 이렇게 연속적인 데이터를 처리하는 데 특화된 명령어들이 내장되어 있습니다."
Changes:
- Images, video, and audio are mostly but not totally sequential, hence "데이터의 대부분이 ~". This change forced me to omit "processing" part, but it is implied from the context.
- "연속적" and "순차적" have both temporal and spatial meaning. Sticking to "연속적" is better since the context "메모리에서" is preserved.
- "특화" seems better since the instructions are not just special but specialized for our goal.
lesson_01/index.ko.md
Outdated
|
|
||
| 짐작하셨겠지만, SIMD는 이미지, 비디오 그리고 오디오처럼 메모리에 연속적으로 정렬된 대량의 데이터를 처리할 때 매우 효과적입니다. 이러한 순차적 데이터를 효율적으로 처리하기 위해 CPU에는 특수한 명령어들이 내장되어 있습니다. | ||
|
|
||
| FFmpeg에서는 "어셈블리 함수", "SIMD", "벡터화(vectorize)"라는 용어들이 혼재되어 사용되지만, 모두 여러 데이터 요소를 한 번에 처리하기 위해 어셈블리어로 직접 함수를 작성했다는 의미로 나타냅니다. 어떤 프로젝트에서는 이를 "어셈블리 커널(assembley kernel)"이라고 부르기도 합니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 의미로 나타냅니다 → 의미입니다, assembley → assembly, also 혼재되어 사용되지만 can be just 혼용되지만
I'm not sure but if "assembly function", "SIMD", and "vector(ise)" refer to comments in FFmpeg code (not this guide) it should be written intact like "어셈블리 함수(assembly function)", "벡터(vector)", or "벡터화(vectorise)".
lesson_01/index.ko.md
Outdated
|
|
||
| FFmpeg에서는 "어셈블리 함수", "SIMD", "벡터화(vectorize)"라는 용어들이 혼재되어 사용되지만, 모두 여러 데이터 요소를 한 번에 처리하기 위해 어셈블리어로 직접 함수를 작성했다는 의미로 나타냅니다. 어떤 프로젝트에서는 이를 "어셈블리 커널(assembley kernel)"이라고 부르기도 합니다. | ||
|
|
||
| 이 모든 것이 당장은 복잡하게 느껴질 수도 있지만, FFmpeg에서는 고등학생들도 어셈블리 코드를 작성했다는 점을 기억하는게 중요합니다. 어떤 것을 배우든 그 과정의 시작은 용어 익히기, 나머지 끝은 실제로 이해하기입니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 기억하는게 → 기억하는 게
어떤 것을 배우든 그 과정의 시작은 용어 익히기, 나머지 끝은 실제로 이해하기입니다.
Original: As with everything, learning is 50% jargon and 50% actual learning.
I strongly suggest "모든 것이 그렇듯이 공부의 반은 용어이고 나머지 반이 진짜 공부입니다." since this phrase is mainly emphasizing the amount of jargons.
lesson_01/index.ko.md
Outdated
|
|
||
| ## 왜 어셈블리어를 사용하나요? | ||
|
|
||
| 결론부터 말씀드리자면 멀티미디어를 빠르게 처리하기 위해서입니다. 어셈블리어로 작성된 코드는 10배 이상의 속도 향상을 가져오는 경향이 있으며, 특히 실시간으로 끊김 없는 영상을 재생하려는 경우에 특히 중요합니다. 추가로 에너지 소비를 줄이고 배터리 수명을 늘리는 데도 도움이 됩니다. 비디오 인코딩 및 디코딩 기능은 대기업의 데이터센터를 포함한 일반 사용자 모두에게 지구상에서 가장 많이 사용되는 기능 중 하나라는 점을 강조하고 싶습니다. 따라서 작은 개선도 빠르게 누적됩니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어셈블리어로 작성된 코드는 10배 이상의 속도 향상을 가져오는 경향이 있으며, 특히 실시간으로 끊김 없는 영상을 재생하려는 경우에 특히 중요합니다.
Original: It’s very common to get a 10x or more speed improvement from writing assembly code, which is especially important when wanting to play videos in real time without stuttering.
This is misleading. It should be "어셈블리어로 코드를 작성해서 속도를 10배 이상 향상시키는 일은 아주 흔하며, 영상을 실시간으로 끊김 없이 재생하려면 특히 중요합니다." Current translation reads as if assembly code is naturally fast, which is not.
비디오 인코딩 및 디코딩 기능은 대기업의 데이터센터를 포함한 일반 사용자 모두에게 지구상에서 가장 많이 사용되는 기능 중 하나라는 점을 강조하고 싶습니다.
Original: It’s worth pointing out that video encode and decode functions are some of the most heavily used functions on earth, both by end-users and by big companies in their datacentres.
I suggest "비디오 인코딩 및 디코딩 기능은 개인 사용자부터 대기업의 데이터센터에 이르기까지 지구상에서 가장 많이 사용되는 기능 중 하나라는 점도 중요합니다."
Changes:
- More like typo: "일반 사용자" does not contain "대기업의 데이터센터" in normal sense.
- This sentence is more like a build-up for the real point (small improvements matter) so less direct "중요합니다" feels more appropriate here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had forgotten about “~에 이르기까지”. very good suggestion
lesson_01/index.ko.md
Outdated
|
|
||
| 결론부터 말씀드리자면 멀티미디어를 빠르게 처리하기 위해서입니다. 어셈블리어로 작성된 코드는 10배 이상의 속도 향상을 가져오는 경향이 있으며, 특히 실시간으로 끊김 없는 영상을 재생하려는 경우에 특히 중요합니다. 추가로 에너지 소비를 줄이고 배터리 수명을 늘리는 데도 도움이 됩니다. 비디오 인코딩 및 디코딩 기능은 대기업의 데이터센터를 포함한 일반 사용자 모두에게 지구상에서 가장 많이 사용되는 기능 중 하나라는 점을 강조하고 싶습니다. 따라서 작은 개선도 빠르게 누적됩니다. | ||
|
|
||
| <!-- online과 intrisics를 어떻게 번역할지 grocery를 정한 다음 수정을 할 필요가 있음. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest "인터넷에서" "웹상에서" for online (I don't think this belongs to glossary), "컴파일러 내장 함수" "(컴파일러) 인트린직" for "intrinsics". "Intrinsics" here refers only to compiler intrinsics, different from "내장 함수(normally language builtins)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"컴파일러 내장함수" seems best, but this term appears multiple times later on. I think it would be good to indicate that we'll use "인트린직" as a substitute going forward. something like "컴파일러 내장함수(이하 인트린직) ...".
For "online," "인터넷 커뮤니티에서" seems more natural. "웹상에서" feels a bit ambiguous (still better than "주변에서").
How do you think?
lesson_01/index.ko.md
Outdated
| 결론부터 말씀드리자면 멀티미디어를 빠르게 처리하기 위해서입니다. 어셈블리어로 작성된 코드는 10배 이상의 속도 향상을 가져오는 경향이 있으며, 특히 실시간으로 끊김 없는 영상을 재생하려는 경우에 특히 중요합니다. 추가로 에너지 소비를 줄이고 배터리 수명을 늘리는 데도 도움이 됩니다. 비디오 인코딩 및 디코딩 기능은 대기업의 데이터센터를 포함한 일반 사용자 모두에게 지구상에서 가장 많이 사용되는 기능 중 하나라는 점을 강조하고 싶습니다. 따라서 작은 개선도 빠르게 누적됩니다. | ||
|
|
||
| <!-- online과 intrisics를 어떻게 번역할지 grocery를 정한 다음 수정을 할 필요가 있음. --> | ||
| 주변(online)에서는 intrinsics(내장 함수)을 사용하는걸 흔하게 볼 수 있습니다. 이는 어셈블리 명령어에 매핑되는 C 스타일 함수로, 주로 개발 속도를 높이기 위해 사용됩니다. 하지만 FFmpeg에서는 이러한 intrinsic을 사용하지 않고 어셈블리어 코드를 직접 작성합니다. 이 부분에 대해선 논쟁이 있지만, 컴파일러에 따라 일반적으로 intri은sics는 수작업으로 작성된 어셈블리 코드보다 약 10~15% 정도 느린 것으로 알려져 있습니다. FFmpeg에서는 가능한 모든 성능을 끌어내는 것이 중요하기 때문에, intrinsic에 의존하지 않는 방식을 택하고 있습니다 (옹호자들은 동의하지 않겠지만요). 또한 intrinsic은 변수에 [헝가리안 표기법](https://en.wikipedia.org/wiki/Hungarian_notation)을 사용하고 있기 때문에 읽기 어렵다는 의견도 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
또한 intrinsic은 변수에 헝가리안 표기법을 사용하고 있기 때문에 읽기 어렵다는 의견도 있습니다.
I suppose "변수에" should be omitted?
lesson_01/index.ko.md
Outdated
| <!-- online과 intrisics를 어떻게 번역할지 grocery를 정한 다음 수정을 할 필요가 있음. --> | ||
| 주변(online)에서는 intrinsics(내장 함수)을 사용하는걸 흔하게 볼 수 있습니다. 이는 어셈블리 명령어에 매핑되는 C 스타일 함수로, 주로 개발 속도를 높이기 위해 사용됩니다. 하지만 FFmpeg에서는 이러한 intrinsic을 사용하지 않고 어셈블리어 코드를 직접 작성합니다. 이 부분에 대해선 논쟁이 있지만, 컴파일러에 따라 일반적으로 intri은sics는 수작업으로 작성된 어셈블리 코드보다 약 10~15% 정도 느린 것으로 알려져 있습니다. FFmpeg에서는 가능한 모든 성능을 끌어내는 것이 중요하기 때문에, intrinsic에 의존하지 않는 방식을 택하고 있습니다 (옹호자들은 동의하지 않겠지만요). 또한 intrinsic은 변수에 [헝가리안 표기법](https://en.wikipedia.org/wiki/Hungarian_notation)을 사용하고 있기 때문에 읽기 어렵다는 의견도 있습니다. | ||
| 수 | ||
| 또한 FFmpeg 코드 중 일부에는 역사적인 이유로 인라인 어셈블리가 남아 있는 경우가 있으며, 리눅스 커널 같은 프로젝트에서도 아주 특수한 목적을 위해 사용되곤 합니다. 인라인 어셈블리는 어셈블리어를 별도의 파일이 아닌 C 코드 내부에 직접 작성하는 방식입니다. 하지만 FFmpeg과 같은 프로젝트에서는 이런 코드가 읽기 어렵고, 컴파일러에서 널리 지원되지 않으며 유지보수가 어렵다는 것이 일반적인 의견입니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하지만 FFmpeg과 같은 프로젝트에서는 이런 코드가 읽기 어렵고, 컴파일러에서 널리 지원되지 않으며 유지보수가 어렵다는 것이 일반적인 의견입니다.
Original: The prevailing opinion in projects like FFmpeg is that this code is hard to read, not widely supported by compilers and unmaintainable.
I strongly suggest "하지만 이런 코드는 읽기 어렵고, 여러 컴파일러에서 널리 지원하지 않으며, 유지보수가 어렵다는 것이 FFmpeg와 같은 프로젝트에서의 주된 의견입니다." The original text says that the opinion is prevailing in FFmpeg, not that the content applies to FFmpeg. I don't really understand what "projects like FFmpeg" specifically are, by the way.
lesson_01/index.ko.md
Outdated
| 수 | ||
| 또한 FFmpeg 코드 중 일부에는 역사적인 이유로 인라인 어셈블리가 남아 있는 경우가 있으며, 리눅스 커널 같은 프로젝트에서도 아주 특수한 목적을 위해 사용되곤 합니다. 인라인 어셈블리는 어셈블리어를 별도의 파일이 아닌 C 코드 내부에 직접 작성하는 방식입니다. 하지만 FFmpeg과 같은 프로젝트에서는 이런 코드가 읽기 어렵고, 컴파일러에서 널리 지원되지 않으며 유지보수가 어렵다는 것이 일반적인 의견입니다. | ||
|
|
||
| 마지막으로 인터넷에서는 "컴파일러가 알아서 벡터화를 해주기 때문에 어셈블리어는 더 이상 필요 없다"고 주장하는 '자칭 전문가'들도 자주 볼 수 있습니다. 하지만 적어도 학습 단계에서는 신경쓰지 않아도 됩니다. 예를 들어 [dav1d 프로젝트](https://www.videolan.org/projects/dav1d.html)의 최근 테스트에서는 컴파일러의 자동 벡터화가 약 2배의 속도 향상을 보여준 반면, 수작업으로 작성한 버전은 최대 8배 까지의 성능 개선을 보여주었습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 8배 까지의 → 8배까지의 and following
lesson_01/index.ko.md
Outdated
|
|
||
| ## 어셈블리어의 종류 | ||
|
|
||
| 이 강좌는 x86 64비트 어셈블리어를 중심으로 다룹니다. amd64라고도 하지만 인텔 CPU에서도 동일하게 동작합니다. 이 밖에도 ARM이나 RISC-V 같은 다른 CPU용 어셈블리어가 있으며, 이러한 아키텍처 까지 강의가 확장될 가능성도 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor note: "강의" was used at the beginning
lesson_01/index.ko.md
Outdated
|
|
||
| ## 참고 자료 | ||
|
|
||
| 의외로 책이나 Stack Overflow 같은 온라인 자료는 참고용으로 그다지 도움이 되지 않을 수도 있습니다. 이는 부분적으로 Intel 문법을 사용한 수작업 어셈블리를 선택했기 때문이기도 하지만, 많은 온라인 자료들이 주로 운영체제나 하드웨어 프로그래밍에 초점을 맞추고 있으며, 대부분 SIMD를 사용하지 않는 코드를 다루고 있기 때문입니다. FFmpeg 어셈블리는 특히 고성능 이미지 처리에 중점을 두고 있으며, 보시게 되겠지만 어셈블리 프로그래밍에서 특히 독특한 접근 방식을 취합니다. 하지만 이 강좌를 완료하고 나면 다른 어셈블리 활용 사례들을 쉽게 이해할 수 있게 될 것입니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
의외로 책이나 Stack Overflow 같은 온라인 자료는 참고용으로 그다지 도움이 되지 않을 수도 있습니다.
Original: You might be surprised to hear that books or online resources like Stack Overflow are not particularly helpful as references.
I suggest "책이나 Stack Overflow 같은 온라인 자료가 참고 자료로서 특별히 유용하지는 않다고 하면 놀라실 것 같습니다." The original text is more conclusive.
lesson_01/index.ko.md
Outdated
|
|
||
| 질문을 할 수 있는 디스코드 서버도 있습니다: https://discord.com/invite/Ks5MhUhqfB | ||
|
|
||
| ## 레지스터 (Register) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor note: spaces before parentheses are inconsistent.
lesson_01/index.ko.md
Outdated
|
|
||
| 첫 번째 종류의 레지스터는 범용 레지스터(GPR, General Purpose Register)라고 불립니다. '범용'이라는 이름은 이 레지스터가 데이터(최대 64비트 값)나 메모리 주소(포인터)를 모두 담을 수 있기 때문에 붙었습니다. GPR에 들어 있는 값은 덧셈, 곱셈, 시프트(shift) 등의 연산을 통해 처리할 수 있습니다. | ||
|
|
||
| 대부분의 어셈블리 관련 서적에서는 GPR의 세부 동작 방식이나 역사적 배경 등에 대해 지면을 할애해 다룹니다. 이는 운영체제 프로그래밍이나 리버스 엔지니어링처럼 GPR이 중요한 분야가 있기 때문입니다. 그러나 FFmpeg에서 작성하는 대부분은 어셈블리 코드는 GPR은 보조적인 역할(scaffolding)에 가깝기 때문에 복잡한 세부 기능이 필요하지 않은 경우가 많아 대부분 추상화 되어 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
대부분의 어셈블리 관련 서적에서는 GPR의 세부 동작 방식이나 역사적 배경 등에 대해 지면을 할애해 다룹니다.
Original: In most assembly books, there are whole chapters dedicated to the subtleties of GPRs, the historical background etc.
This should be "대부분의 어셈블리 관련 서적에서는 GPR 사이의 차이점이나, GPR의 역사적 배경 등에 대해 지면을 할애해 다룹니다."
Subtleties, in this (historical) context, seem to be the purposes of different GPRs, e.g. rcx is used in counters.
그러나 FFmpeg에서 작성하는 대부분은 어셈블리 코드는 GPR은 보조적인 역할(scaffolding)에 가깝기 때문에 복잡한 세부 기능이 필요하지 않은 경우가 많아 대부분 추상화 되어 있습니다.
Original: In the assembly code written in FFmpeg, GPRs are more like scaffolding and most of the time their complexities are not needed and abstracted away.
Also I suggest: "FFmpeg에서 작성하는 어셈블리 코드에서 GPR은 형식적인 도구에 가깝고, 대부분의 경우 그런 복잡한 맥락은 불필요하기 때문에 추상화되어 사라집니다."
- "scaffolding" is not a jargon here. The point is: It is only important that GPRs can store values.
- I can't fully express "abstract away" in Korean but the "removal" of complexity is the point at least.
lesson_01/index.ko.md
Outdated
| 벡터(SIMD) 레지스터는 이름 그대로 여러 개의 데이터 요소를 담을 수 있는 레지스터입니다. 이 레지스터에는 여러 종류가 있습니다. | ||
|
|
||
| - **mm 레지스터**: MMX 레지스터, 64비트 크기, 현재는 잘 사용되지 않음 | ||
| - **xmm 레지스터**: XMM 레지스터, 128비트 크기, 널리 사용됨 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"widely available" should be "대부분의 환경에서 사용 가능"
lesson_01/index.ko.md
Outdated
|
|
||
| 비디오 압축과 압축 해제에서 대부분의 연산은 정수 기반이므로 여기서는 정수 데이터를 기준으로 설명하겠습니다. | ||
|
|
||
| 다음은 xmm 레지스터에 담긴 16바이트의 예시입니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Along with the following examples, it should be "16개의 바이트가 xmm 레지스터에 담긴 예시입니다."
lesson_01/index.ko.md
Outdated
|
|
||
| ## 간단한 어셈블리 예제 | ||
|
|
||
| 이번에는 간단한 (인위적이지만요) 스칼라 어셈블리 코드 조각(snippet)을 보면서 어떤 일들이 일어나는지 살펴보겠습니다. 여기서 _스칼라 어셈블리_ 란, 각 명령이 한 번에 하나의 데이터 항목만 처리하는 어셈블리 코드를 의미합니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이번에는 간단한 (인위적이지만요) 스칼라 어셈블리 코드 조각(snippet)을 보면서 어떤 일들이 일어나는지 살펴보겠습니다.
I suggest "이번에는 인위적이지만 간단한 스칼라 어셈블리 코드를 보면서 어떤 일이 일어나는지 살펴보겠습니다."
lesson_01/index.ko.md
Outdated
|
|
||
| `inc` 명령은 값을 1 증가시켜 `r0q`를 4로 만들고, `dec` 명령은 값을 1 감소시켜 다시 3으로 되돌립니다. 마지막으로 `imul` 명령으로 5를 곱해 최종적으로 `r0q`에는 15가 저장됩니다. | ||
|
|
||
| 참고로 `mov`, `inc`와 같이 사람이 읽을 수 있는 형태의 명령어는 어셈블러에 의해 머신 코드로 변환되며, 이를 **니모닉(mnemonic)** 이라고 부릅니다. 책이나 온라인 자료에서는 니모닉을 `MOV`, `INC` 같이 대문자로 표기하는 경우도 있지만, 소문자 버전과 의미는 동일합니다. FFmpeg에서는 니모닉은 소문자로 작성하고 대문자는 매크로 용도로만 사용합니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pharse '버전' seems a little bit unnecessary here, we can just omit like "대문자로 표기하는 경우도 있지만 의미는 동일합니다."
lesson_01/index.ko.md
Outdated
|
|
||
| 첫 번째 줄은 주석이며 C 코드에서 해당 함수의 인자 형식을 보여줍니다. 어셈블리에서 세미콜론 `;`은 C의 `//`와 동일한 역할을 합니다. | ||
|
|
||
| 두 번째 줄은 이 함수가 SSE2 명령어 집합을 사용하여 XMM 레지스터를 초기화하도록 설정합니다. 이는 아래에서 사용할 `paddb`가 SSE2 명령어이기 때문입니다. SSE2에 대해서는 다음 강의에서 더 자세히 다룰 예정입니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
두 번째 줄은 이 함수가 SSE2 명령어 집합을 사용하여 XMM 레지스터를 초기화하도록 설정합니다.
Original: The second line shows how we are initialising the function to use XMM registers, using the sse2 instruction set.
I suggest "두 번째 줄은 SSE2 명령어 집합을 이용해 해당 함수가 XMM 레지스터를 사용하도록 설정합니다."
- The assembly initializes the function, not the XMM registers.
- For the term 'initialization, I chose '설정' as "해당 함수가 XMM 레지스터를 사용하도록 초기화합니다" seems awkward. There might be a better expression than both, though.
lesson_01/index.ko.md
Outdated
|
|
||
| `mov`에서 대괄호 `[]`는 해당 주소를 역참조한다는 뜻이며, C언어의 `*src`와 같습니다. 이를 **로드(load)** 라고 합니다. 여기서 `q` 접미사는 포인터 크기를 나타내며 (64비트 시스템에서 `sizeof(*src) == 8`), 32비트 시스템에서는 자동으로 32비트를 사용합니다. 하지만 실제 로드는 128비트 단위로 이루어집니다. | ||
|
|
||
| 또한 벡터 레지스터는 `xmm0`처럼 전체 이름으로 부르지 않고 `m0`같이 추상화된 이름을 사용합니다. 이렇게 하면 한 번 작성한 코드를 다양한 크기의 SIMD 레지스터에서 사용할 수 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current sentence has a structure "벡터 레지스터는 ~이름을 사용합니다", it would be better if we refine it.
| movu [srcq], m0 | ||
| ``` | ||
|
|
||
| 이 명령은 **스토어(store)** 라고 불립니다. `scrq` 포인터가 가리키는 주소에 데이터를 다시 써 넣는 동작입니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor typo: scrq -> srcq
lesson_01/index.ko.md
Outdated
|
|
||
| 이 매크로는 함수가 반환됨을 나타냅니다. FFmpeg의 거의 모든 어셈블리 함수는 값을 반환하기보다는 인자로 전달된 데이터 자체를 수정하는 방식을 사용합니다. | ||
|
|
||
| 곧 보게될 실습에서는 어셈블리 함수를 가리키는 함수 포인터를 만들고 활용하는 시간을 가지겠습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another minor typo: 보게될 -> 보게 될.
evenharder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the hard work, here are some comments for Lesson 2.
lesson_02/index.ko.md
Outdated
|
|
||
| 첫 번째 어셈블리어 함수를 작성해 보았습니다. 이번에는 분기(branch)와 반복문(loop)을 소개하겠습니다. | ||
|
|
||
| 먼저 레이블과 점프(jump)의 개념을 알아야 합니다. 아래의 예제에서 `jmp` 명령어는 코드 실행을 `.loop:` 뒤로 이동시킵니다. `.loop:`는 **레이블**이라 부르며, 레이블 앞에 붙은 점(`.`)은 이것이 로컬 레이블(local label)임을 나타냅니다. 로컬 레이블을 사용하면 여러 함수에서 동일한 레이블을 재사용할 수 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This single paragraph is already tough! Here are some suggestions
- "
.loop:뒤로 이동시킵니다": to specify the next instruction, I suggest ".loop:` 직후의 명령으로 이동시킵니다". - 로컬 레이블: Instead of transliteration of 'local' to '로컬', how about '지역'? There are a number of examples for this direction such as 지역 변수 (local variable).
lesson_02/index.ko.md
Outdated
| } while(i > 0) | ||
| ``` | ||
|
|
||
| 이 코드는 약간 부자연스럽습니다. 일반적인 C코드의 반복문은 다음과 같이 작성합니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor note: "작성합니다" is a little bit odd, we can omit as "~다음과 같습니다."
lesson_02/index.ko.md
Outdated
|
|
||
| 더욱 현실적인 반복문을 만들기 전에 FLAGS 레지스터를 알아보겠습니다. FLAGS의 세부 동작에 대해서는 깊게 다루지 않겠습니다(앞서 설명했듯이 GPR 연산은 주로 보조 역할이기 때문입니다). 다만, 산술 연산이나 시프트처럼 스칼라 데이터에 대해 `mov` 이외의 대부분의 명령을 실행하면 **Zero-Flag**, **Sign-Flag**, **Overflow-Flag**와 같은 여러 플래그가 설정됩니다. | ||
|
|
||
| 다음은 루프 카운터가 0까지 감소하도록 하고, `jg`(0보다 크면 점프)가 반복 조건이 되는 예시입니다. `dec r0q` 명령은 실행 후 `r0q` 값에 따라 플래그들을 설정하며, 이 플래그를 바탕으로 점프할 수 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The term loop is either translated to '반복문' and '루프'. Both are quite used throughout the material. As this guide is for beginners (or even, beginner programmers), I hope if we can unify both translations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I've revised it to translate as '반복(문)'.
lesson_02/index.ko.md
Outdated
| jl .loop ; jump if (r0q - 3) < 0, i.e (r0q < 3) | ||
| ``` | ||
|
|
||
| 이 코드 조각에서 주목해야 할 점이 몇 가지 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about omitting "조각" (snippet) here? Or we can paraphrase to "예시 코드".
lesson_02/index.ko.md
Outdated
|
|
||
| 첫째, `xor r0q, r0q`는 레지스터를 0으로 만드는 흔한 방법입니다. 일부 시스템에서는 `mov r0q, 0`보다 더 빠를 수 있는데, 간단히 설명하면 실제 메모리 로드 동작이 일어나지 않기 때문입니다. 이 방식은 SIMD 레지스터에서도 사용할 수 있으며, 예를 들어 `pxor m0, m0`[^1]는 전체 레지스터를 0으로 초기화합니다. | ||
|
|
||
| 둘째, `cmp`의 사용입니다. `cmp`는 첫 번째 피연산자에서 두 번째 피연산자를 뺀 값을 어디에도 저장하지 않고, 그 결과에 따라 FLAGS를 설정합니다. 주석의 내용처럼 점프 명령과 함께 읽어야 하며, `jl`(jump if less than zero)는 `r0q < 3`일 때 점프하게 됩니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석의 내용처럼 점프 명령과 함께 읽어야 하며
Original: ..., but as per the comment, it can be read together with the jump, ...
I suggest "주석의 내용처럼 점프 명령과 같이 조합되면". as we still get the meaning where cmp can be combined with jump instructions.
lesson_02/index.ko.md
Outdated
|
|
||
| 또한 이 코드에는 추가 명령어(`cmp`)가 하나 더 있다는 점을 유의해야 합니다. 일반적으로 명령어 수가 적을수록 코드가 더 빠르므로 이전 예제의 방식이 더 선호됩니다. 앞으로의 강의에서 보겠지만, 이러한 추가 명령을 피하고 산술 연산이나 다른 연산에서 바로 FLAGS를 설정하는 다양한 기법들이 있습니다. | ||
|
|
||
| 마지막으로, C의 반복문을 어셈블리 코드에서 정확히 동일하게 재현하려는 것이 아닌, 가능한 한 빠르게 동작하는 반복문을 작성하는 것이 목적이라는 것을 기억해야 합니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest "어셈블리를 작성하는 이유가 C언어 반복문의 완벽한 재현이 아니라 가능한 한 빠르게 동작하는 반복문 작성임을 기억해야 합니다." My point here is that we can remove redundant ~것 here.
lesson_02/index.ko.md
Outdated
| constants_2: times 2 dw 4,3,2,1 | ||
| ``` | ||
|
|
||
| * `SECTION_RODATA`는 읽기 전용 데이터 섹션임을 지정합니다. (운영체제가 사용하는 출력 파일 형식마다 선언 방식이 다르므로 매크로로 정의되어 있음) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the parentheses and make a full sentence with a period here.
|
|
||
| 오프셋이란 메모리에서 연속된 요소 간의 거리(바이트 단위)를 말하며, 자료 구조의 각 요소 크기에 따라 결정됩니다. | ||
|
|
||
| 이제 반복문을 작성할 수 있게 되었고, 데이터를 읽어볼 차례입니다. 다만 C언어와는 다른 점이 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestion: "이제 반복문을 작성할 수 있으니" instead of "이제 반복문을 작성할 수 있게 되었고"
| * **base** - GPR(일반적으로 C 함수 인자로 받은 포인터) | ||
| * **scale** - 1, 2, 4, 8 중 하나 (기본값: 1) | ||
| * **index** - GPR(보통 루프 카운터) | ||
| * **disp** - 32비트 정수. 데이터 내부의 오프셋(변위, displacement) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor correction: "(최대 32비트) 정수" instead of "32비트 정수" for clarity.
Original: This is an integer (up to 32-bit)
lesson_02/index.ko.md
Outdated
| * **index** - GPR(보통 루프 카운터) | ||
| * **disp** - 32비트 정수. 데이터 내부의 오프셋(변위, displacement) | ||
|
|
||
| x86 어셈블리는 현재 사용 중인 SIMD 레지스터 크기를 알려주는 `mmsize` 상수를 제공합니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is misleading as mmsize is an alias provided by x86inc.asm. Instead of "x86 어셈블리" we should use "x86inc.asm" instead.
|
@kiwiyou @evenharder |
WIP
Translating the assembly lessons into Korean, with plans to translate all available documents.
Note: Converted bold text separators to proper markdown headers for better rendering